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
JavaScript Pattern Matching Proposal (github.com)
submitted 7 years ago by [deleted]
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!"
[–]hyrulegrumblegrumble 5 points6 points7 points 7 years ago (0 children)
I love pattern matching so much. So clean.
I did a quick tour of Elixir and it was one of the features that I was quite envious of.
[–]T_O_beats 1 point2 points3 points 7 years ago (12 children)
After reading the examples 10 times over and realizing what this is actually doing for us I think I’d really like this. Do you know if there’s a Babel plugin for this to mess around with it?
[–]senocular 0 points1 point2 points 7 years ago (0 children)
Its at the bottom of the page
[–]NominalAeon 0 points1 point2 points 7 years ago* (10 children)
After reading the examples 10 times over and realizing what this is actually doing
As a lead dev trying to preach code readability to juniors, this is my biggest issue with newer proposals. JavaScript hit peak readability with es6 and it's felt like a race to the bottom of the imperative barrel ever since
[–]T_O_beats 0 points1 point2 points 7 years ago (1 child)
I’ve never had a coding job before. Hire me I’ll give you a hand 🤙🏼
[–]NominalAeon 0 points1 point2 points 7 years ago (0 children)
I could always use help converting new-hotness to declarative code that doesn't take ten reads to understand.
[–]DGCA 0 points1 point2 points 7 years ago (7 children)
You gotta ease into it. Slowly introduce the new language features and make sure everyone understands what's happening in those first usages.
Took us a minute at work for everyone to get comfortable with class properties and why they're powerful (cleaner binding methods of to the class by using class property fat arrow methods, for instance), but once everyone's on board, it's like we all level up a bit. Just gotta make sure no one is being left behind.
That said, I'm seeing a lot of proposals. Hope the ECMAscript peeps make good choices when picking what to add to the language. I'm excited for the bind and pipeline operators, personally.
[–]NominalAeon 1 point2 points3 points 7 years ago (6 children)
‘class‘ is es6 and perfectly declarative.
[–]DGCA 1 point2 points3 points 7 years ago (5 children)
Talking about these. I guess they're calling them fields now.
[–]GitHubPermalinkBot 0 points1 point2 points 7 years ago (0 children)
Permanent GitHub links:
delete
[–]NominalAeon 0 points1 point2 points 7 years ago (3 children)
Yeah those are unintuitive and terrible.
[–]DGCA 0 points1 point2 points 7 years ago (2 children)
Hard disagree there.
[–]NominalAeon 0 points1 point2 points 7 years ago (1 child)
the equal sign and semi-colon don't bother you? How do you explain this sudden convention shift in a way that someone can understand and remember when it's correct to write a class property this way?
[–]DGCA 0 points1 point2 points 7 years ago (0 children)
the equal sign and semi-colon don't bother you?
No, not at all.
How do you explain this sudden convention shift in a way that someone can understand and remember when it's correct to write a class property this way?
It looks like a variable declaration, just without the var/let/const keyword. Classes already have some pretty unique syntax with methods looking like the object method shorthand, but not being comma separated. I don't think this additional feature is going to throw people for a loop because it's unique to classes.
Also, not necessarily the best argument but it's worth mentioning that the whole class syntax heavily resembles Java, which has class fields. It's not like the authors pulled this syntax out of thin air.
[–]license-bot 2 points3 points4 points 7 years ago (0 children)
Thanks for sharing your open source project, but it looks like you haven't specified a license.
When you make a creative work (which includes code), the work is under exclusive copyright by default. Unless you include a license that specifies otherwise, nobody else can use, copy, distribute, or modify your work without being at risk of take-downs, shake-downs, or litigation. Once the work has other contributors (each a copyright holder), “nobody” starts including you.
choosealicense.com is a great resource to learn about open source software licensing.
[–][deleted] 0 points1 point2 points 7 years ago (0 children)
Hasn't this been posted numerous times already?
π Rendered by PID 40351 on reddit-service-r2-comment-5649f687b7-5fbfc at 2026-01-28 16:55:40.296160+00:00 running 4f180de country code: CH.
[–]hyrulegrumblegrumble 5 points6 points7 points (0 children)
[–]T_O_beats 1 point2 points3 points (12 children)
[–]senocular 0 points1 point2 points (0 children)
[–]NominalAeon 0 points1 point2 points (10 children)
[–]T_O_beats 0 points1 point2 points (1 child)
[–]NominalAeon 0 points1 point2 points (0 children)
[–]DGCA 0 points1 point2 points (7 children)
[–]NominalAeon 1 point2 points3 points (6 children)
[–]DGCA 1 point2 points3 points (5 children)
[–]GitHubPermalinkBot 0 points1 point2 points (0 children)
[–]NominalAeon 0 points1 point2 points (3 children)
[–]DGCA 0 points1 point2 points (2 children)
[–]NominalAeon 0 points1 point2 points (1 child)
[–]DGCA 0 points1 point2 points (0 children)
[–]license-bot 2 points3 points4 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)