sorry mate, thumbs down here as well ... confusing with RegExp too, no easy
spread, neither shorter, abuse of dollar sign within code and no nested
possibility if not through arguments trap and extra vars declarations ... a
bit "meh" compared with what's already in place as proposal.

br

On Tue, Apr 17, 2012 at 11:33 AM, Peter van der Zee <e...@qfox.nl> wrote:

> Why can't lambda's be a simple case of a lexically scoped `return`
> keyword with any arguments implicitly defined and accessible through a
> predefined identifier/keyword (much like `arguments` works now)?
>
> arr.map(return '<'+arguments[0]+'
> class="'+this.getClassName(arguments[1])+'"/>');
>
> arr.map(return '<'+$0+' class="'+this.getClassName($1)+'"/>');
>
> arr.map(return '<'+$[0]+' class="'+this.getClassName($[1])+'"/>');
>
> Or maybe the hash sign...
>
> arr.map(return '<'+#0+' class="'+this.getClassName(#1)+'"/>');
>
> It's going to be hard to come up with a solid grammar for allowing
> statements this way though (return {foo:bar} would be an objlit, not a
> block with label). Is that why it's not being considered?
>
> You could work around that by restricting grammar for `return` and
> `{`. So `return{` would always start a block. I'm aware that this is
> also currently valid syntax for returning an object literal, but I
> think objections over introducing more restricted grammar rules trumps
> that anyways... :)
>
> Anyways, I like it because it's short, consise, and it feels very
> intuitive to me. We'd basically overload the return keyword much like
> the function keyword is right now. As a statement it'd remain the
> same. As an expression it becomes shorthand notation for a function.
>
> - peter
> _______________________________________________
> es-discuss mailing list
> es-discuss@mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to