How about replacing <| with ->

Quildreen Motta quildreen at gmail.com
Sat Mar 3 13:26:09 PST 2012


I find the syntax `proto -> object' counter-intuitive. Anytime I think 
about prototype delegation,
the semantics are clear that an object `X' delegates to a prototype `Y'. 
This semantics don't map
well in `proto -> object', instead you have something more along the 
lines `proto is the basis of
object', although the first thing that comes to mind is still `proto 
maps to object'.

And yes, this is a nitpick.

On the other hand, there are strong associations of such a symbol with 
different semantics
in other languages, property access and function shorthands being the 
most common. I'm
not sure introducing a symbol that's been used for entirely different 
semantics in the majority
of other languages is a good idea, and would bring more confusion.

<- sounds too much like return (local or not).

So, at this point I still think `lhs <| rhs' is the best alternative in 
syntax, as it lends itself easily to the
`rhs delegates to lhs', which is the core semantics of a delegative 
prototype implementation.

On 03/02/2012 07:30 PM, Allen Wirfs-Brock wrote:
> It was recently suggested to me that it is unlikely that we will ever 
> adopt -> as as function expression shorthand symbol and that this 
> means we could consider using that symbol sequence for other purposes. 
>  In particular, it would be a reasonable and possibly less 
> controversial alternative to the <| symbol.  I would have no objection 
> to that switch and have written the suggestion up at 
> http://wiki.ecmascript.org/doku.php#suggestion_to_replace_with
>
> Some examples of this usage of -> include:
>
>    MyObject.prototype  ->  {a:1,b:2}
>    appArrayBehavior->[0,1,2,3,4,5]
>    let subclass = superclass ->  function  ()  {};
>    var  p = newRegExpMethods ->  /[a-m][3-7]/
>
> What do you think? Do you like -> better than <| ?  Is it ok to not 
> have it available for some possible future function shorthand?
>
> Allen
>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120303/a380c7af/attachment.html>


More information about the es-discuss mailing list