Alternative syntax for <|

Claus Reinke claus.reinke at talk21.com
Tue Nov 22 09:48:46 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

was to interpret

    proto <| {..}

as a source representation of the unwritable

    { [[prototype]]: proto , .. }

> Two problems:
>
> 1. Does not work for array, function, and regexp literal right-hand sides.

With my original suggestion, could work for array, and regexpr,
and function. The difference from the original <| was just that I
wanted to interpret <| directly as structure representation, not
as an operator taking a full object rhs.

Though I suggested to eliminate the special case for function,
and to set only [[prototype]], not 'prototype' as well.

We should be explicit about setting function's [[prototype]] or
setting function's 'prototype' (the [[prototype]] for new objects).

> 2. Preempts a property name. We cannot preempt 'prototype',
> and '__proto__' was already tried (it sucks due to preemption
> combined with magic meta-programming power in what looks
> like just another property).

Not an issue with my original suggestion, as the name is implicit.

Claus
http://clausreinke.github.com/
 



More information about the es-discuss mailing list