prototype for operator proposal for review

Sean Eagan seaneagan1 at gmail.com
Fri May 20 14:32:32 PDT 2011


To me, the lighter weight of ~ and : make them more contextually
visually distinct than | next to object, array, and regexp literal
brackets [ { /

<: kind of looks like a jet with two rocket engines on the back which
might be memorable.  It could be called the "jet operator" or "rocket
operator".

<~ has the disadvantage that it looks somewhat similar to <- and thus ->

Here's a good visual test of the possible cases, in case it helps:

p <| []
p <: []
p <~ []

p <| {}
p <: {}
p <~ {}

p <| /\d+/
p <: /\d+/
p <~ /\d+/

p <| function f(){}
p <: function f(){}
p <~ function f(){}

p <| ""
p <: ""
p <~ ""

p <| 1
p <: 1
p <~ 1

p <| false
p <: false
p <~ false

Also, whichever one is picked, why not allow it to point in either
direction, just always towards the [[Prototype]] ?  Using the reverse
direction for different semantics in the future would be confusing.
The forward direction would be useful if you only wanted the
[[Prototype]] to be used by one object:

{x: "x", y: "y"} ~> {
  foo: function(){...},
  bar: function(){...}
}


On Wed, May 18, 2011 at 6:20 PM, David Herman <dherman at mozilla.com> wrote:
> It's okay in Courier New but not in lots of other popular monospaced fonts. See attached image.
>
> Dave
>
>
>
>
> On May 18, 2011, at 3:30 PM, Allen Wirfs-Brock wrote:
>
>>
>> On May 18, 2011, at 3:14 PM, David Herman wrote:
>>
>>>> I think I like <: about as much as  <|.  I'm not sure which is going to be more readable across a variety of fonts and sizes.  <| does seem to be generally more visually distinct.
>>>
>>> I just have to say that the pipe symbol in many fonts makes for a really hideous triangle. It doesn't line up at all with the top and bottom of the less-than/greater-than symbols.
>>>
>>>> I suspect that to most JS programmers the UML open triangle generalization arrow head is at least as relevant a precedent as any type theory uses.  In other words,the relevancy of either isn't very high.
>>>
>>> Yeah. In fact, the analogy to type theory would have us read the <: symbol as a binary predicate, which isn't what's going on here at all.
>>>
>>> So... I don't find either of these lexemes very pleasant, but I don't have any beautiful alternatives to offer.
>>>
>>> Dave
>>>
>>
>> It's highly variable, but on average they both generally look better in a mono-spaced fonts.
>>
>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>

Cheers,
Sean Eagan


More information about the es-discuss mailing list