Refutable destructuring

Brian Di Palma offler at gmail.com
Sat Aug 10 05:19:40 PDT 2013


It looks to me like there are people who want a sort of ducktypeof operator.

arg1 ducktypeof MyClass

Which would return true if the shape of arg1 where the same as MyClass. If
I wanted to write as a refutable pattern I could end up with a large block
that may be repeated in several class methods.

It would be nice to shorten that so that you could declare tersely that
your methods require a specific shape to be passed in.
On Aug 10, 2013 1:47 AM, "Brandon Benvie" <bbenvie at mozilla.com> wrote:

> On 8/9/2013 5:45 PM, Allen Wirfs-Brock wrote:
>
>> and if we make U+2639 a special token that evaluated to throw TypeError
>> we could say
>>
>>    function foo( {a=☹ }) {}
>>
>
> This would be awesome.
> ______________________________**_________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/**listinfo/es-discuss<https://mail.mozilla.org/listinfo/es-discuss>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130810/e9a74764/attachment.html>


More information about the es-discuss mailing list