MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/badcode/comments/msv49l/when_your_teammate_refactor_your_code/guvy18d/?context=3
r/badcode • u/Bence675 • Apr 17 '21
216 comments sorted by
View all comments
298
This is why I like languages with nice pattern matching, as it can often make code like this compact in a nice way. Something along the lines of
match (condition1, condition2) { (true, true) => do_anything1(), (false, _) => do_anything2(), }
13 u/YaBoiiBillNye Apr 17 '21 True pattern matching like F# is gonna be the next big thing for languages. I think performance will be sacrificed for it. It's awesome 12 u/[deleted] Apr 17 '21 It doesn't need to come with a performance penalty I think. Anyway I think pattern matching will definitely be a must have for many future languages, and imho it's how switch-case should have been from the start.
13
True pattern matching like F# is gonna be the next big thing for languages. I think performance will be sacrificed for it. It's awesome
12 u/[deleted] Apr 17 '21 It doesn't need to come with a performance penalty I think. Anyway I think pattern matching will definitely be a must have for many future languages, and imho it's how switch-case should have been from the start.
12
It doesn't need to come with a performance penalty I think. Anyway I think pattern matching will definitely be a must have for many future languages, and imho it's how switch-case should have been from the start.
298
u/[deleted] Apr 17 '21
This is why I like languages with nice pattern matching, as it can often make code like this compact in a nice way. Something along the lines of