On Fri, Mar 2, 2012 at 2:30 PM, Allen Wirfs-Brock <[email protected]> wrote:
> 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?
I’ve been contemplating a +> symbol.
prototype +> {a: 1, b: 2}
arrayExtras +> [1,2,3]
let sub = super +> function () {};
var p = regexpExtras +> /[a-m][3-7]/
There may be little precedent for abusing operators in JavaScript, but
in other systems, I would expect adding collections to produce the
union of those collections, with precedence given to the right hand
operand. In a world where [1,2,3] + [4,5,6] = [1,2,3,4,5,6] and
{a:10, b:20} + {b:30} = {a:10, b:30}, I think that +> would make sense
as an alternative to +, where the result shadows instead of snapshots
the left hand side for the same effect until it changes.
Kris Kowal
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss