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

Brendan Eich brendan at
Sun Nov 21 19:48:25 PST 2010

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> 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 and
> 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 <>. 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.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list