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
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss