Remix.run Logo
munificent 5 hours ago

If you like both object-oriented programming and sum/product types with deep support for pattern matching, you might like Dart.

https://dart.dev/language/records

https://dart.dev/language/patterns#algebraic-data-types

https://dart.dev/language/patterns

IshKebab 4 hours ago | parent [-]

I really like Dart, and it's clearly far superior to its competitors in the "old imperative" space, like Python, Javascript (though Typescript obviously has fancier types), Java, and even Go IMO.

The frustrating thing is that it's so close to the functional features that Rust embraced (mainly that everything is an expression), but it just brushes against it. Like, with Python and Javascript, you know they're shit. Nobody expects to be able to write a switch that evaluates to a lambda or whatever in Python. But Dart is just so close to greatness but just misses!

They even added switch expressions recently, but with a different syntax to switch statements! So close!

Still, overall it's a great language and really deserves more market share. In particular the dev tooling is the best of any language I've used. The LSP server is instantaneous. Nothing else comes close.