I'd expect that
o = { a : b = 5 }
Was legal now, setting both o.a and b to 5. Not at a shell, is there an
exception in the grammar for assignment expressions in the value position?
{ a = 5 : T } might work, though.
Mike
On Nov 22, 2010 6:09 PM, "Waldemar Horwat" <[email protected]> wrote:
> On 11/22/10 10:13, Brendan Eich wrote:
>>> { foo : G : 33 }
>>
>> 0. let typedObj = { foo : 33 } : { foo : G }; // a la ES4
>>
>> 1. let typedObj = { foo :: G : 33 }; // the guards strawman
>>
>> 2. let typedObj = { (foo : G) : 33 }; // the ML-ish way
>>
>> 3. let typedObj = { foo @ G : 33 }; // funny cartoon chars
>
> Good list. Out of those five, the only one I'd find compelling would be
the first:
>
> { foo : G : 33 }
>
> Alternatives 0, 1, and 3 have the problems that were already well-stated.
2 has strange placement of parentheses.
>
> If we're brainstorming, I'd throw out an alternative for the object
initializer syntax:
>
> {name: value} // What we have now, for compatibility
> {name = value} // Identical behavior to {name: value}
> {name: type = value} // Adding a type annotation
>
> If we're looking at other ASCII characters for type annotations, a few
other characters such as the backtick might be an option:
>
> {name`type: value}
> {name!type: value}
> {name%type: value}
> {name~type: value}
>
> Waldemar
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss