Alternative syntax for <|

Claus Reinke claus.reinke at talk21.com
Fri Nov 25 08:07:32 PST 2011


>>>> Recently Claus Reinke proposed some alternative that I think feels is
>>>> so much more natural and simpler than <| or beget:
>>>> ..
>>>> .. re-interpretation deleted ..
>>
>> Ahem;-) Glad to see my proposal noticed, but what I really
>> suggested, in
>>
>>   motivating <| as structure representation, not operator
>>   https://mail.mozilla.org/pipermail/es-discuss/2011-November/018626.html
>> ..
>
> Nothing there about arrays or regular expressions, and the function
> examples do *not* show anything like
>
>  superFun <| function (...) {...}
>
> Instead of Ahem'ing, could you cite what you claim is a prior proposal
> with specifics showing how it addresses object, array, regexp and function
> [[Prototype]] presetting?

My proposal was no separate proposal in the ES wiki sense, but a
suggestion about re-interpreting and modifying the existing proposal
about <| . Specifically, it

>> was to interpret
>>
>>   proto <| {..}
>>
>> as a source representation of the unwritable
>>
>>   { [[prototype]]: proto , .. }

As such, it inherits most aspects of the original proposal. In brief,

    proto <| literal

is the object generated from literal, with [[prototype]] set to proto,
where the literal can be any object-generating literal (object, array,
regexp, or function).

The two modifications to the original proposal were:

- <| structurally represents an unnameable property;
    so it does not need to modify its rhs, it only applies to
    literals, and it can be used in destructuring

- <| only makes the [[prototype]] property representable;
    so there is no special case for 'proto <| function', all
    literals are treated the same way;

    instead of modifying 'function's 'prototype' property,
    one would write 'function(..){..; return super <| {..}}'

Claus
http://clausreinke.github.com/
 



More information about the es-discuss mailing list