Is JavaScript Pattern Matching Likely to Move Forward?

0
2
Asked By MellowCactus47 On

I really like the pattern-matching approach provided by libraries such as ts-pattern, and I'd love to see something similar become part of JavaScript itself. Is there meaningful support for the proposal, and is it likely to advance through the language-standardization process anytime soon?

3 Answers

Answered By OrbitingPanda8 On

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

Answered By QuietMarble6 On

In the meantime, destructuring, ordinary conditionals, and switch statements can cover some of the same use cases. They’re less expressive and less concise, but they’re available today without waiting for a language proposal.

Answered By CopperLynx22 On

There has been interest in pattern matching before, but progress has stalled more than once. The idea seems appealing to many people, yet the proposal is also quite large and introduces a lot of new syntax. Standardization tends to be cautious about making the language bigger and harder to learn, so the proposal would first need an active group of champions and substantial design work before it could move forward.

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.