Refutable destructuring

Axel Rauschmayer axel at rauschma.de
Fri Aug 9 15:36:40 PDT 2013


> While I agree this is interesting and should be explored further, I reject the proposal to add more meaning to the "!" character. Given this proposal, "!" would sometimes mean "not" or "negate" (as in it's current form) and sometimes mean "a required thing". Meanwhile, "refute" is a synonym for "negate", which is the opposite of what you're claiming the semantics would be, ie. irrefutable, "impossible to omit" or "impossible to deny [a value for this identifier binding]".

I agree. `+` may be a better choice (reminiscent of regular expressions as opposed to the boolean operator). Then the code becomes:

    let { +a: foo, b: bar } = { a: 1 };  // foo = 1, b = undefined
    let { +a: foo, b: bar } = { };  // exception

    function bla(+mandatoryArg, optionalArg1, optionalArg2 = 123) {
        ...
    }



-- 
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/20130810/0f866c7f/attachment.html>


More information about the es-discuss mailing list