It has been my experience that professional JavaScripters will cheer
*any* idea that shortens the spelling of "function" and "return" :)

Brendan has said that 8 characters for "function" is at least 6 too
many.  I think it's probably at least 7 too many.  But it'd be a shame
to remove the character-count-tax only to introduce a
twisting-wrist-tax.  I'd prefer something closer to the middle of
(most) keyboards than -> or {|.  #() is pretty nice, actually.

When I suggested "doing away with blocks", I of course was not
referring to structures where the block is relevant, such a function
bodies, if/else, try/catch/finally, or loops.  I was talking about
having a bare unadorned block in JavaScript.  These are relevant in C,
where you have block-scope, but in JavaScript have only made it
trickier to know whether something is supposed to be an Object-literal
or a block with labelled lines.  For example:

return {
  foo: "bar"
}
// vs
return
{
  foo: "bar"
}



On Sat, May 7, 2011 at 14:39, Claus Reinke <[email protected]> wrote:
>   function bodies extend as far as possible **

I see.  So, a function body would be just like an if-block or loop
body.  One full statement, or a block.  There is precedent for that in
the rest of the language.  So, then, this case:

x = function () y; z

would be:

x = function () { return y }; z

am I understanding that correctly?

--i
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to