An Alternative Pattern Matching Proposal

I wanted to use pattern matching, and found that there is an existing proposal at stage 1. Unfortunately, it really doesn't currently seem like it's very realistic. I came up with an alternative proposal here, and would like to get some feedback. This proposal is meant to be very easy to implement and easily extendable. However, I'm debating whether or not this should be an expression or a statement (it is currently a statement).

Could you elaborate on what seems unrealistic about it?

(Note that I've just taken over recently as champion for that proposal, and it hasn't yet been updated)

I had no idea about what you have now when I wrote this because I couldn't see your updates, so I went with what I saw:

  • Examples in the readme itself contradict slightly
  • The syntax is ambiguous and deviates from destructuring syntax in a potentially confusing way
  • I saw several attempts to implement it with babel that ran into problems, so it seems too complicated for what it's worth
  • It's taken quite a few years with little progress and I assumed that I could improve it by coming in from a slightly different approach

With that said, regardless of how realistic may be now with your updates, I think that my proposal is worth consideration

1 Like