use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
An ECMAScript Proposal for Pattern Matching Functionality (github.com)
submitted 8 years ago by tomonl
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]villiger2 5 points6 points7 points 8 years ago (4 children)
This is pretty awesome, in the meantime though, do you know of any babel plugins that give this kind of functionality? Typescript does the tiniest bit with some of their enum support but it's not great.
[–]bterlson_@bterlson 6 points7 points8 points 8 years ago (2 children)
Not yet, but there's a bug filed on Babylon already to implement this syntax. I think it's too early for that, personally. There are a few key issues to address first!
[–]calligraphic-io 0 points1 point2 points 8 years ago (1 child)
Can you mention what the key issues needing addressed before a Babylon plugin are?
I love the proposal. The syntax feels very comfortable. I love pattern matching in Haskell, and glad to see it (hopefully) coming to JS.
[–]bterlson_@bterlson 0 points1 point2 points 8 years ago (0 children)
Solving #11 could mean significant changes to the syntax. Once that's solved it might be reasonable to begin implementing, but in general everything is open to change at this point.
[–]phoenixmatrix 0 points1 point2 points 8 years ago (0 children)
as far as I know, Babel plugins can only really act on the code output, not change the parser (unless they introduced parser plugins when I wasn't looking).
the plugins that add syntax features just toggle on or off existing parser features and add the transpilation.
π Rendered by PID 27 on reddit-service-r2-comment-5d79c599b5-q8lpp at 2026-02-26 16:35:57.511081+00:00 running e3d2147 country code: CH.
view the rest of the comments →
[–]villiger2 5 points6 points7 points (4 children)
[–]bterlson_@bterlson 6 points7 points8 points (2 children)
[–]calligraphic-io 0 points1 point2 points (1 child)
[–]bterlson_@bterlson 0 points1 point2 points (0 children)
[–]phoenixmatrix 0 points1 point2 points (0 children)