On Thu, Aug 21, 2008 at 4:33 PM, Peter Michaux <[EMAIL PROTECTED]> wrote:
>
> which is handy in a language that constantly deals with side effects.
> There is no Scheme "begin" or Lisp "progn" expression being proposed
> which means we will have to write the following pattern
>
> var y;
> let (x = 34) {
>  // side effects lines
>  document.getElementById('foo').className="n"+x;
>  // "return" y
>  y = x+4;
> }
>
> where it would be nice to write something like
>
> var y = let (x = 34) begin {
>  document.getElementById('foo').className="n"+x;
>  x+4;
> }

There are comma expressions in ES, so using a let expression:

var y = let (x = 34)
    document.getElementById('foo').className="n"+x,
    x+4;

... would do what you want, I believe.

-Jon
_______________________________________________
Es-discuss mailing list
Es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to