[alt.lang.cfutures] Assignment in test: OK?

brnstnd@kramden.acf.nyu.edu (Dan Bernstein) (09/13/90)

In article <18326@ultima.socs.uts.edu.au> jeremy@sinope.socs.uts.edu.au (Jeremy Fitzhardinge) writes:
> >> BTW, if I ever write a new C-like language, ":=" will be the assignment
> >> operator, "==" the comparison operator, and "=" totally invalid!  Although
> If you are going to prevent assignment in a conditional, you are preventing
> it from being an expression.  This stops things like "a=b=c=0;" from falling
> out elegantly.

Q has == for comparison, = for assignment with no value, and := for
assignment with a value. (Among others.) So ``a = b'' still works,
``if (a = b)'' is illegal, and the compiler can check all statements
for unused values. The only correct code that has to be rewritten is
``a = b = c = d'' (as ``a = b := c := d'') and a proper ``if (a = b)''
(as ``if (a := b)'').

Followups to alt.lang.cfutures.

---Dan