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@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss