local

Peter Michaux petermichaux at gmail.com
Thu Aug 21 19:06:27 PDT 2008


On Thu, Aug 21, 2008 at 1:45 PM, Jon Zeppieri <jaz at bu.edu> wrote:
> On Thu, Aug 21, 2008 at 4:33 PM, Peter Michaux <petermichaux at gmail.com> 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.

That does seem to cover the use case I was describing.

Thanks.

Peter


More information about the Es-discuss mailing list