[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: %and, %or, and the return value of assignment



haahr@mv.us.adobe.com (Paul Haahr) wrote:

> Noah wrote me privately, saying
> 
> > In older versions of es, %and and %or returned the last value they
> > evaluated, rather than a mere true or false value.  The former
> > behavior was quite useful and I personally relied on it heavily.
> 
> i agree that the new behavior is wrong.  i started looking at how to
> rewrite %and and %or (aka, && and ||), and i saw that it would be
> much easier to get them right if the assignment operator (=)
> returned the value that was assigned rather than what it currently
> does, which is always return true.

Does this require

  x=<={y='foo'}

or

  x=y='foo'

?

As a new user of es and a professional functional programmer, I find
the concept of values `returning' from an expression appears to be a
bit broken in es, but I get the impression from initial.es that there
has been debate on this topic in the past.  Perhaps someone could send
the rationale to the list.
---
Richard Brooksby <richard@harlequin.co.uk>
ML Project / Symbolic Processing Division / Harlequin
+44 223 872522