Re:TypeScript Is Surprisingly OK for Compilers
by pjmlp on Friday August 18, 2023 @04:53AM
(#37172955)
C# and Swift have pattern matching.
[ Parent
| on HN ]
Re:TypeScript Is Surprisingly OK for Compilers
by troupo on Friday August 18, 2023 @04:57AM
(#37172980)
It's more limited than what you'd ideally want: pattern matching in function definitions. This makes walking ASTs a breeze.
Edit: And inline pattern matching for values returned from expressions and function calls (similar to destructuring, but more powerful).