Comments on Refutable Patterns proposal

Axel Rauschmayer axel at rauschma.de
Thu Mar 21 11:01:15 PDT 2013


>> Ah! I would expect [x,y] to only match arrays whose length is 2. Is there a benefit to being more lenient?
> I wouldn't expect that at all, for the same reason I would expect `let { x, y } = { x: 1, y: 2, z: 3 }` to work.

I’m influenced by Prolog that has [x,y] and [x,y | rest]. Matching by position feels different to me than matching by key, but I see your point. It is also consistent with how function parameters are handled.

-- 
Dr. Axel Rauschmayer
axel at rauschma.de

home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130321/81463de8/attachment-0001.html>


More information about the es-discuss mailing list