Does JavaScript pattern matching have a realistic chance of reaching the language?

0
2
Asked By MellowCedar42 On

I really like the capabilities provided by libraries such as ts-pattern, and I'd love to see pattern matching become a native JavaScript feature. Is the proposal making meaningful progress through TC39, and is there enough support for it to eventually move forward?

3 Answers

Answered By CopperSparrow6 On

For now, destructuring, if statements, and regular switch statements cover many practical cases. They’re less elegant than dedicated pattern matching, but they’re available today and don’t add another major syntax system for developers to learn.

Answered By BrightOtter7 On

The proposal is currently at Stage 1, so it’s still very early. I wouldn’t expect it to arrive in JavaScript anytime soon—possibly not for many years.

Answered By QuartzLemon19 On

There does seem to be interest from some TC39 delegates, but the proposal has had a rough history. Work has stalled and restarted before, and it covers a lot of syntax and behavior. That makes it more difficult to advance, especially while TC39 is cautious about adding large new features to the language. It could eventually happen, but the proposal would first need active champions and sustained development again.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.