Syntax for union types
Brendan Eich
brendan at mozilla.org
Sat Nov 10 15:04:30 PST 2007
Thanks. I filed:
http://bugs.ecmascript.org/ticket/300
asking for this change. As I wrote there, this kind of fine-tuning of
syntax (the UI to the language) should not be cut off by the new
proposals cutoff, any more than fiddling over JSON APIs should be cut
off or frozen prematurely. So I'll advocate for this change in the
group.
/be
On Nov 10, 2007, at 1:02 PM, P T Withington wrote:
> +1 for |
>
> On 2007-11-09, at 13:21 EST, Brendan Eich wrote:
>
>> As Lars suggested, we have bigger fish to fry, but we settled on
>> union syntax quickly and were content to stay there. I'm not against
>> | instead of , and if enough people think it's the right user
>> interface, we could consider it again. I'm not saying it's a good use
>> of time to fuss over this, but it's "fixable" if (T, U, ...) is not
>> as good as (T | U | ...).
>>
>> Recall that ES4 and indeed JavaScript do not have tuples, so we want
>> to use [T, U] for the array structural type describing a tuple of at
>> least index 0 of type T and index 1 of type U. If we ever did add
>> tuples, then Yuh-Ruey has a point I think: we might rather use (T |
>> U) for union of T and U, and (T, U) -- or possibly (T, U,) to match
>> expression syntax (which would have to be (e1, e2,) to avoid
>> ambiguity with comma expression) for tuple type.
>>
>> /be
> _______________________________________________
> Es4-discuss mailing list
> Es4-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es4-discuss
More information about the Es4-discuss
mailing list