I like pattern matching but don't think it would work well for ES, although I'd 
love to see a proposal that proves me wrong. My main concerns would be:
*       What are you matching on? Constructor, `instanceof`, duck typing, 
prototype etc
*       What happens when one type can be coerced to another.
*       What happens in the case that the matching identifier doesn't exist? - 
such as with `Object.create(null, {})`

Alex



-----Original message-----
From: Sebastian Malton
Sent: Monday, July 3 2017, 12:44 pm
To: Henrik Sommerland; es-discuss
Subject: Re: Pattern matching?

 
Are you thinking kind of like Rust's match statement? I think that something 
like that would be quite a good addition.

Sebastian 
 
 
 
 
 
 
 
 
From: [email protected]
Sent: June 30, 2017 9:55 AM
To: [email protected]
Subject: Pattern matching?
 
 
Why is there no support for pattern matching in JavaScript?
I would guess that it has been proposed before, and if so why hasn't it been 
included?

I have been thinking about it and I think it would integrate nicely into 
JavaScript.
If it hasn't been proposed already I would propose it, and I would gladly look 
into it more and try to examine what kind of semantics would be suitable.

Peace!
-- 
Henrik "TheGrandmother" Sommerland

_______________________________________________

es-discuss mailing list

[email protected]

https://mail.mozilla.org/listinfo/es-discuss



_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to