I don't think we can get away with repurposing _ as a pattern sigil, since it's 
already a valid identifier and used by popular libraries:

    http://documentcloud.github.com/underscore/

In my strawman for pattern matching, I used * as the "don't-care" pattern:

    http://wiki.ecmascript.org/doku.php?id=strawman:pattern_matching

Dave

On Oct 6, 2011, at 2:04 AM, Andreas Rossberg wrote:

> On 5 October 2011 21:19, Sean Eagan <seaneag...@gmail.com> wrote:
> However, I don't see why variable declaration array destructuring
> binding and parameter lists should be different in any way.  The only
> current syntactic difference between them is elision:
> 
> // allowed
> function f([,,,,,,x]){}
> // disallowed
> function f(,,,,,,x){}
> 
> Only apropos of semantics, but I really don't like this syntax at all. It is 
> far, far too easy to overlook a hole. I think we should forbid this syntax in 
> Harmony.
>  
> If we want to support "holes" in patterns -- and I'm all for it! -- then we 
> should do what all other languages with proper pattern matching do and 
> introduce explicit syntax for wildcards, namely "_". That simplifies both 
> syntax and semantics (because it's more compositional) and increases 
> readability:
> 
> function f([_, _, _, x]){}
> function f(_, _, _, x){}
> 
> This has been suggested before, but I want to reinforce the point.
> 
> (I'm far less convinced about allowing holes in expressions, but an argument 
> could be made that "_" is simply syntax for undefined in expressions. No more 
> writing "void 0".)
> 
> /Andreas
> 
> _______________________________________________
> es-discuss mailing list
> es-discuss@mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss

_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to