Guards are now ready for discussion (was: Nov 18 notes)

Mark S. Miller erights at google.com
Sun Nov 21 19:52:41 PST 2010


On Sun, Nov 21, 2010 at 7:48 PM, Brendan Eich <brendan at mozilla.com> wrote:

> On Nov 21, 2010, at 7:40 PM, Mark S. Miller wrote:
>
> On Sun, Nov 21, 2010 at 7:05 PM, Brendan Eich <brendan at mozilla.com> wrote:
>
>> On Nov 18, 2010, at 4:08 PM, Waldemar Horwat wrote:
>> [...]
>> Worse, the use of colon in this new for syntax is confusingly similar to
>> long-standing future-proofing intentions around runtime type annotations
>> (aka guards or contracts).
>>
>> (BTW, I don't think :: is a good type annotation or guard punctuator, btw
>> -- it's the C++ namespace qualification operator, also specified for
>> namespacing by ECMA-357 (E4X) and used that way in ActionScript 3 (and in
>> ES4, RIP). So I was surprised to see :: used for annotation-like syntax in
>> http://wiki.ecmascript.org/doku.php?id=strawman:guards and
>> http://wiki.ecmascript.org/doku.php?id=strawman:trademarks.)
>>
>
> Note that I do not consider the trademarks strawman ready for discussion.
> Accordingly I had recently moved it from the strawman page to the deferred
> page. I want to do a rather extensive rewrite before I'll be happy enough
> with it.
>
>
> Thanks, I didn't mean to spotlight it, hence my parentheses (and double
> BTW/btw ;-).
>
>
> I think the guards strawman is in fine shape for discussion. It postpones
> most of the semantic issues to other specs (like trademarks eventually) that
> would parameterize the guards strawman by proposing a concrete meaning for
> its internal Coerce___ function.
>
> The reason I chose "::" over ":" is not for a love of "::". Alternative
> suggestions appreciated! However, I avoided ":" so that we could guard
> properties within object literals <
> http://wiki.ecmascript.org/doku.php?id=strawman:guards#guarding_properties>.
> I don't see a way to use ":" for that without confusion. The ES4 solution --
> that one can only annotate an object literal as a whole but not its
> individual properties -- always seemed unpleasant.
>
>
> :: is strictly less pleasant, and really kind of "taken" due to the
> precedents I cited. The "less pleasant" point is the big one IMHO.
>

Can we find something better than "::" that doesn't conflict with the ":" in
the object literal syntax? As I said, I have no love for "::".



>
> /be
>
>


-- 
    Cheers,
    --MarkM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20101121/f1895b0d/attachment-0001.html>


More information about the es-discuss mailing list