- Subject: [slang-users] comparison operator grammar change
- From: "John E. Davis" <davis@xxxxxxxxxxxxx>
- Date: Mon, 16 Oct 2006 02:36:21 -0400
Hi,
For slang-2.1, I am thinking about making a change to the part of the
grammar that deals with the four comparison operators <, <=, >, >=.
In particular, I would like for boolean expressions such as
a < b <= c
to mean
((a < b) and (b <= c)).
Similarly,
a < b <= c < d
would mean
(a < b) and (b <= c) and (c < d).
This change would not only add clarity to code, but would also result in
some performance gain. For example, compare
if ((r0 <= hypot(x,y)) and (hypot(x,y) < r1))
do_something ();
to
if (r0 <= hypot(x,y) < r1)
do_something ();
Unfortunately, such a change would break backward-compatibility.
Currently, a<b<=c is a valid expression and is equivalent to (a<b)<=c.
My feeling is that usage of such constructs is extremely rare in
existing slang code, whereas I imagine that with the proposed
semantics, these syntactic forms would become quite common.
Any thoughts on this matter?
Thanks,
--John
PS. I will be releasing 2.0.7 soon and after that I intend to start on
the 2.1 series.
_______________________________________________
To unsubscribe, visit http://jedsoft.org/slang/mailinglists.html
[2006 date index]
[2006 thread index]
[Thread Prev] [Thread Next]
[Date Prev] [Date Next]