- Subject: Re: bug(?) in black3 and Guido Gonzato's updates
- From: "John E. Davis" <davis@xxxxxxxxxxxxx>
- Date: Tue, 24 Nov 2009 11:36:53 -0500
Jörg Sommer <joerg@xxxxxxxxxxxx> wrote:
> Yes, me too. I thought it was the effect of a change anywhere else,
> because black3.sl doesn't define keyword and keyword1. From which
> color table these settings are inherited?
These keywords are in the defined in the file:
# grep keyw black3.sl
set_color("keyword", "brightred", $2); % if, while, unsigned, ...
set_color("keyword1", "green", $2); % malloc, exit, etc...
set_color("keyword2", $1, $2);
set_color("keyword3", $1, $2);
set_color("keyword4", $1, $2);
set_color("keyword5", $1, $2);
set_color("keyword6", $1, $2);
set_color("keyword7", $1, $2);
set_color("keyword8", $1, $2);
set_color("keyword9", $1, $2);
> Oh, I've thought the equivalent code is insert_spaces (--goal, goal), but
> you are the developer of S‐Lang and you are right. Thanks for reviewing
> these patches.
I think the confusion arises because slang and C differ here. In C,
all statements, including assignment statements, produce a value. For
example, in C
x = (foo = bar);
is equivalent to
foo = bar;
x = bar;
because foo=bar will evaluate to bar. In contrast, in S-Lang
x=(foo=bar) will generate a StackUnderflow exception, since foo=bar
does not produce a value that can be assigned to x.
This also means that C distingushes between X++ and ++X:
X = 1;
Y = X++; ==> Y=1, X=2;
X = 1;
Y = ++X; ==> Y = 2, X=2;
However, since X++ does not produce a value in S-Lang, there is no
difference between X++ and ++X. This also means that in S-Lang one
cannot use the commmon idiom:
i = 10;
while (i--) { ... }
Instead, the above can be written in S-Lang using:
i = 10;
while (i, i--) { ... }
Hopefully the S-Lang documentation adequately explains these
differences.
Thanks,
--John
--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.
[2009 date index]
[2009 thread index]
[Thread Prev] [Thread Next]
[Date Prev] [Date Next]