simple shorter function syntax
Alex Russell
alex at dojotoolkit.org
Sat Jul 24 11:00:38 PDT 2010
On Jul 24, 2010, at 9:21 AM, Kevin Curtis wrote:
> Should the proposed shorter form # desugar to function or a const function:
> http://wiki.ecmascript.org/doku.php?id=strawman:const_functions
Regular, plain-old function. No funky return semantics (ala some of the closure proposals), no extra qualifiers. If you want 'em, you can pay for 'em. The common problem "#" attempts to address is the huge verbosity of "function", nothing more.
> I dislike the verbosity of function - though I can't help feeling #
> could be used for other ends.
>
> let dict = #{"hello": 4, "world":5}; // it's a hash/dict not an object
So a new dictonary/map type is interesting, but it's unclear that we really need anything like that until/unless we turn off the "delete" operator.
> let arr = #[4,4,5] // typed array - Numbers only - contiguous memory block?
How about we start with the long form for things that are currently uncommon and shorten them when they become painfully long to use?
Regards
> Maybe the verbosity of function is painful when used as an anonymous
> function. Does the blackslash idea for anon functions (only) work
> grammar wise:
>
> doIt(\(x) { alert(x * x) } ); // braces
> doIt(\(x) ( x * x)); // parens - no return
> let myfun = \(x) (x * x);
>
> Also, is anything proposed for rationalizing ASI in Harmony.
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
--
Alex Russell
slightlyoff at google.com
slightlyoff at chromium.org
alex at dojotoolkit.org BE03 E88D EABB 2116 CC49 8259 CF78 E242 59C3 9723
More information about the es-discuss
mailing list