How about replacing <| with ->

classic Classic list List threaded Threaded
78 messages Options
1234
Reply | Threaded
Open this post in threaded view
|

How about replacing <| with ->

Allen Wirfs-Brock
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
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: How about replacing <| with ->

Kris Kowal-2
On Fri, Mar 2, 2012 at 2:30 PM, Allen Wirfs-Brock <[hidden email]> 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
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: How about replacing <| with ->

Axel Rauschmayer
In reply to this post by Allen Wirfs-Brock
The direction is wrong. It’s what I like most about <| – that it’s graphical, intuitive and indicates a direction.

Is there a list of symbols that have already been rejected? I still like <| best (better than a word such as beget or proto), followed by <~ and <:

On Mar 2, 2012, at 23:30 , 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
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss

-- 
Dr. Axel Rauschmayer



_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: How about replacing <| with ->

Rick Waldron
Allen, that link brings me to the "About this wiki" page

Rick

On Fri, Mar 2, 2012 at 5:46 PM, Axel Rauschmayer <[hidden email]> wrote:
The direction is wrong. It’s what I like most about <| – that it’s graphical, intuitive and indicates a direction.

Is there a list of symbols that have already been rejected? I still like <| best (better than a word such as beget or proto), followed by <~ and <:

On Mar 2, 2012, at 23:30 , 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
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss

-- 
Dr. Axel Rauschmayer



_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss



_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: How about replacing <| with ->

Allen Wirfs-Brock
In reply to this post by Allen Wirfs-Brock
with corrected link to wiki page: http://wiki.ecmascript.org/doku.php?id=harmony:proto_operator#suggestion_to_replace_with 

On Mar 2, 2012, at 2: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?id=harmony:proto_operator#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
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss


_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: How about replacing <| with ->

Rick Waldron
Thanks - This looks really nice!



On Fri, Mar 2, 2012 at 6:20 PM, Allen Wirfs-Brock <[hidden email]> wrote:
with corrected link to wiki page: http://wiki.ecmascript.org/doku.php?id=harmony:proto_operator#suggestion_to_replace_with 

On Mar 2, 2012, at 2: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?id=harmony:proto_operator#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
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss


_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss



_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: How about replacing <| with ->

Axel Rauschmayer
In reply to this post by Axel Rauschmayer
Sorry, I actually meant to ask a question: Isn’t the direction of -> wrong?


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?

-- 
Dr. Axel Rauschmayer



_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

RE: How about replacing <| with ->

Luke Hoban
In reply to this post by Axel Rauschmayer
>> What do you think? Do you like -> better than <| ?  Is it ok to not have it available for some possible future function shorthand?

Both => and -> have strong associations with function shorthands from C#, Scala, C++,  Java 8, Perl, CoffeeScript, ML, Haskell and more.  Whether or not JavaScript adopts a ->/=> shorthand in the future (I still think it should), many developers will think of it as having an association with functions.  Using -> for the proto-of operator effectively also removes the ability to use => as function shorthand later, due to the syntactic similarity of these two operators.

Luke

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: How about replacing <| with ->

Allen Wirfs-Brock
In reply to this post by Axel Rauschmayer

On Mar 2, 2012, at 4:28 PM, Axel Rauschmayer wrote:

> Sorry, I actually meant to ask a question: Isn’t the direction of -> wrong?

It's a matter of opinion.  UML thinks that <| points is pointing in the "right" direction (towards the more general object).  However, a lot of people think about inheritance as methods flowing from/provided by the super thing to the sub thing.  That perspective is more in alignment with ->

At this stage, choice of a symbol seems to be most about what will cause the lesser about of opposition based solely upon the symbol choice.   Some people seem top really hate <|.  If there a reasonable alternatives that don't generate the same sort of negative response then it is worth considering them.

Allen



_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: How about replacing <| with ->

Allen Wirfs-Brock
In reply to this post by Luke Hoban

On Mar 2, 2012, at 4:31 PM, Luke Hoban wrote:

>>> What do you think? Do you like -> better than <| ?  Is it ok to not have it available for some possible future function shorthand?
>
> Both => and -> have strong associations with function shorthands from C#, Scala, C++,  Java 8, Perl, CoffeeScript, ML, Haskell and more.  Whether or not JavaScript adopts a ->/=> shorthand in the future (I still think it should), many developers will think of it as having an association with functions.  Using -> for the proto-of operator effectively also removes the ability to use => as function shorthand later, due to the syntactic similarity of these two operators.

Any of these usages (at least for the more widely used languages) are fairly new so I don't know that they establish that strong of a precedent for ES.

The starting premise for considering -> is that we are not likely to use it (or =>) for a lambda shorthand.  Block lambda seems to be the direction that how the most momentum.

Allen








>
> Luke
>
>

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

RE: How about replacing <| with ->

Luke Hoban
>>>>> What do you think? Do you like -> better than <| ?  Is it ok to not have it available for some possible future function shorthand?
>>
>> Both => and -> have strong associations with function shorthands from C#, Scala, C++,  Java 8, Perl, CoffeeScript, ML, Haskell and more.  Whether or not JavaScript adopts a ->/=> shorthand in the future (I still think it should), many developers will think of it as having an association with functions.  Using -> for the proto-of operator effectively also removes the ability to use => as function shorthand later, due to the syntactic similarity of these two operators.

> Any of these usages (at least for the more widely used languages) are fairly new so I don't know that they establish that strong of a precedent for ES.

They are new now, but 5 years from now when ES6 has breadth adoption these other languages will also be 5 years more established.  Many programmers will work in at least one of these other languages as well as in JavaScript.  There is also a relatively strong association of C-style languages using ->/=> as function shorthand, and JavaScript is still (for better or worse) primarily seen as a C-style language.

Luke

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: How about replacing <| with ->

Axel Rauschmayer
In reply to this post by Allen Wirfs-Brock
It's a matter of opinion.  UML thinks that <| points is pointing in the "right" direction (towards the more general object).

I thought about the [[Prototype]] property pointing from the “prototypee” to the prototype. And of the way prototype (property lookup) chains go from prototypees to prototypes.

However, a lot of people think about inheritance as methods flowing from/provided by the super thing to the sub thing.  That perspective is more in alignment with ->

OK, as in “prototype of”.

At this stage, choice of a symbol seems to be most about what will cause the lesser about of opposition based solely upon the symbol choice.   Some people seem to really hate <|.  If there a reasonable alternatives that don't generate the same sort of negative response then it is worth considering them.

Agreed. At this point, I’ll be fine with any notation, as long as we eventually have this operator. I’m normally wary of grawlixification, but this is one case where (IMO) something grawlixy works well.

So far any proposal I have seen has been met with strong opposition. How does one resolve such stalemates? Popular vote? But design by the people is usually even worse than design be committee – Fred Brooks argues that good design is best decided by a single person (two, if one of them is dominant). A TC39 vote? A BDFL decree?

-- 
Dr. Axel Rauschmayer



_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: How about replacing <| with ->

Brendan Eich-2
In reply to this post by Luke Hoban
I'm with Luke here. We shouldn't abuse a common idiom from other
languages, including upstream ones such as CoffeeScript.

Kris's suggestion of +> changed to deal with the "wrong direction"
criticism (which I find compelling since the [[Prototype]] property is a
reference):

   let sub = sup +< {p:1, q:2};

(E4X ambiguity, no worries.)

Comments?

/be

Luke Hoban wrote:

>>>>>> What do you think? Do you like ->  better than<| ?  Is it ok to not have it available for some possible future function shorthand?
>>> Both =>  and ->  have strong associations with function shorthands from C#, Scala, C++,  Java 8, Perl, CoffeeScript, ML, Haskell and more.  Whether or not JavaScript adopts a ->/=>  shorthand in the future (I still think it should), many developers will think of it as having an association with functions.  Using ->  for the proto-of operator effectively also removes the ability to use =>  as function shorthand later, due to the syntactic similarity of these two operators.
>
>> Any of these usages (at least for the more widely used languages) are fairly new so I don't know that they establish that strong of a precedent for ES.
>
> They are new now, but 5 years from now when ES6 has breadth adoption these other languages will also be 5 years more established.  Many programmers will work in at least one of these other languages as well as in JavaScript.  There is also a relatively strong association of C-style languages using ->/=>  as function shorthand, and JavaScript is still (for better or worse) primarily seen as a C-style language.
>
> Luke
>
> _______________________________________________
> es-discuss mailing list
> [hidden email]
> https://mail.mozilla.org/listinfo/es-discuss
>
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: How about replacing <| with ->

Herby Vojčík
In the spirit of "derives from" (it really is more intuitive for most,
though I liked <| because I already got used to UML direction), I'd throw in

==> (as in "it follows (that)")

I also wanted to add something like modus ponens character used in
logic, but

|-

does not work, it already has its own meaning.

Herby

Brendan Eich wrote:

> I'm with Luke here. We shouldn't abuse a common idiom from other
> languages, including upstream ones such as CoffeeScript.
>
> Kris's suggestion of +> changed to deal with the "wrong direction"
> criticism (which I find compelling since the [[Prototype]] property is a
> reference):
>
> let sub = sup +< {p:1, q:2};
>
> (E4X ambiguity, no worries.)
>
> Comments?
>
> /be
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: How about replacing <| with ->

Axel Rauschmayer
In reply to this post by Brendan Eich-2
More possibilities (Alas, <* does not work, because the asterisk is not vertically centered in some fonts), in order of preference (the first one has already been suggested, but AFAIK not been rejected, yet).

let sub = sup <: {p:1, q:2};
let sub = sup <~ {p:1, q:2};
let sub = sup <> {p:1, q:2};
let sub = sup >< {p:1, q:2};


On Mar 3, 2012, at 7:00 , Brendan Eich wrote:

> I'm with Luke here. We shouldn't abuse a common idiom from other languages, including upstream ones such as CoffeeScript.
>
> Kris's suggestion of +> changed to deal with the "wrong direction" criticism (which I find compelling since the [[Prototype]] property is a reference):
>
>  let sub = sup +< {p:1, q:2};
>
> (E4X ambiguity, no worries.)
>
> Comments?

--
Dr. Axel Rauschmayer
[hidden email]

home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: How about replacing <| with ->

Brandon Benvie
Overloading bitwise operators, which is pretty easy to determine?

var parent = { prop1: parent1 };

inherit + overrides
var obj =  parent | {  prop1: newValue1,  inherit2 :  inherit2 }
= { prop1: parent1, prop2: inherit2 }

inherit - overrides
var diff = proto & { prop1:  newValue1: prop2: value 2 }
= { prop1:  newValue1, prop2: val2 }


I already use constants in this way to represent complex preset objects;

var flags = [
  'PRIVAVTE',
  'ENUMERABLE',
  'CONFIGURABLE',
  'READONLY',
  'WRITABLE',
  'FROZEN',
  'HIDDEN',
  'NORMAL',
];

var flags = {
  get name()
    return flags[this.enumerable | this.configurable << 1 | this.writable << 2]
  },
  set name(){
    this.configurable = Boolean(v & CONFIGURABLE);
    this.enumerable   = Boolean(v & ENUMERABLE);
    this.writable  = Boolean(v & WRITABLE);
  }
}


On Sat, Mar 3, 2012 at 5:24 AM, Axel Rauschmayer <[hidden email]> wrote:
More possibilities (Alas, <* does not work, because the asterisk is not vertically centered in some fonts), in order of preference (the first one has already been suggested, but AFAIK not been rejected, yet).

let sub = sup <: {p:1, q:2};
let sub = sup <~ {p:1, q:2};
let sub = sup <> {p:1, q:2};
let sub = sup >< {p:1, q:2};


On Mar 3, 2012, at 7:00 , Brendan Eich wrote:

> I'm with Luke here. We shouldn't abuse a common idiom from other languages, including upstream ones such as CoffeeScript.
>
> Kris's suggestion of +> changed to deal with the "wrong direction" criticism (which I find compelling since the [[Prototype]] property is a reference):
>
>  let sub = sup +< {p:1, q:2};
>
> (E4X ambiguity, no worries.)
>
> Comments?

--
Dr. Axel Rauschmayer
[hidden email]

home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss


_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: How about replacing <| with ->

Rick Waldron
In reply to this post by Axel Rauschmayer
On Mar 3, 2012, at 5:24 AM, Axel Rauschmayer <[hidden email]> wrote:

> More possibilities (Alas, <* does not work, because the asterisk is not vertically centered in some fonts), in order of preference (the first one has already been suggested, but AFAIK not been rejected, yet).
>
> let sub = sup <: {p:1, q:2};

Yes, <: is still preferred of those that arrow left

> let sub = sup <~ {p:1, q:2};
> let sub = sup <> {p:1, q:2};
> let sub = sup >< {p:1, q:2};
>
>
> On Mar 3, 2012, at 7:00 , Brendan Eich wrote:
>
>> I'm with Luke here. We shouldn't abuse a common idiom from other languages, including upstream ones such as CoffeeScript.
>>
>> Kris's suggestion of +> changed to deal with the "wrong direction" criticism (which I find compelling since the [[Prototype]] property is a reference):
>>
>> let sub = sup +< {p:1, q:2};
>>
>> (E4X ambiguity, no worries.)
>>
>> Comments?
>
> --
> Dr. Axel Rauschmayer
> [hidden email]
>
> home: rauschma.de
> twitter: twitter.com/rauschma
> blog: 2ality.com
>
> _______________________________________________
> es-discuss mailing list
> [hidden email]
> https://mail.mozilla.org/listinfo/es-discuss
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: How about replacing <| with ->

Dean Landolt
In reply to this post by Brendan Eich-2


On Sat, Mar 3, 2012 at 1:00 AM, Brendan Eich <[hidden email]> wrote:
I'm with Luke here. We shouldn't abuse a common idiom from other languages, including upstream ones such as CoffeeScript.

Kris's suggestion of +> changed to deal with the "wrong direction" criticism (which I find compelling since the [[Prototype]] property is a reference):

 let sub = sup +< {p:1, q:2};

(E4X ambiguity, no worries.)

Comments?


I like, though <+ is a little easier on the eyes.

One argument for the "wrong direction" being wrong: if A <: B is common math syntax for A is a subtype of B, if you turn the arrow around it'd read A is a supertype of B, and this is fairly close to what <| was trying to express.

 

/be


Luke Hoban wrote:
What do you think? Do you like ->  better than<| ?  Is it ok to not have it available for some possible future function shorthand?
Both =>  and ->  have strong associations with function shorthands from C#, Scala, C++,  Java 8, Perl, CoffeeScript, ML, Haskell and more.  Whether or not JavaScript adopts a ->/=>  shorthand in the future (I still think it should), many developers will think of it as having an association with functions.  Using ->  for the proto-of operator effectively also removes the ability to use =>  as function shorthand later, due to the syntactic similarity of these two operators.

Any of these usages (at least for the more widely used languages) are fairly new so I don't know that they establish that strong of a precedent for ES.

They are new now, but 5 years from now when ES6 has breadth adoption these other languages will also be 5 years more established.  Many programmers will work in at least one of these other languages as well as in JavaScript.  There is also a relatively strong association of C-style languages using ->/=>  as function shorthand, and JavaScript is still (for better or worse) primarily seen as a C-style language.

Luke

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss


_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: How about replacing <| with ->

John J Barton
On Sat, Mar 3, 2012 at 6:54 AM, Dean Landolt <[hidden email]> wrote:
> One argument for the "wrong direction" being wrong: if A <: B is common math
> syntax for A is a subtype of B, if you turn the arrow around it'd read A is
> a supertype of B, and this is fairly close to what <| was trying to express.

I think the reason that we don't all instantly agree on the direction
is simple: the operation is not directional. The operation is
composition; the operands are not types but components of a type.
Thus I think a 'natural' feeling syntax won't be arrow-ish.

Ultimately Allen is attempting to provide some of the benefit of
setting __proto__ while avoiding some of its problems.  Perhaps a
syntax closer its home?  eg something like a set-prototypeOf property

  { ^:MyObject.prototype, a:1,b:2}

  [0,1,2,3,4,5].^ = appArrayBehavior

  let subclass = Function.create(superclass, {});

  var p  = /[a-m][3-7]/.^ = newRegExpMethods;

jjb
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: How about replacing <| with ->

Axel Rauschmayer
In reply to this post by Dean Landolt
One argument for the "wrong direction" being wrong: if A <: B is common math syntax for A is a subtype of B, if you turn the arrow around it'd read A is a supertype of B, and this is fairly close to what <| was trying to express.

Right! Thus: If the symbol looks like an arrow then it should point from right to left:

     A <| { }
     A <~ { }

If it is loosely reminiscent of subset or superset then it should be “is superset of”.

     A :> { }

One might also be able to reuse the `super` keyword from super references:

     A super { }

The we might need new terminology such as "is super-object of”.

-- 
Dr. Axel Rauschmayer



_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
1234