On Mon, Nov 22, 2010 at 6:54 AM, Brendan Eich <[email protected]> wrote:

>
> The ML-ish solution, which is forward compatible, is to parenthesize:
>
> let typedObj = { (prop1:type1): value1, (prop2:type2): value2, ... };
>
> The parentheses hurt too, but only this case. And it still may win to
> annotate the entire ObjectLiteral sometimes, which would avoid (or move to
> one common guard-type definition) the property-wise annotation overhead.
> Comments?
>

I wouldn't want to introduce forced parens for the sake of disambiguation
for the coder. I'd rather go with ::, # or @ ...

Actually, for object literal I'd go for an equal sign (=), but that
obviously won't fix var declarations where the colon is fine.

Can't the guards proposal be applied to function parameters as well? Or am I
stepping on land mines there? :) It seems like the same logic could be
applied. In that case the equal sign is maybe even more preferable.

- peter
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to