3 ms·
Agreed, the haskell / rust overloading where there's a loosely enforced[^1] but implied contract is probably the best of both worlds. But even without strong c
by habitue 6y ago
Agreed, the haskell / rust overloading where there's a loosely enforced[^1] but implied contract is probably the best of both worlds.
But even without strong constraints, the language's culture is a huge aspect of whether it becomes a problem or not. For example, in python, the language has almost[^2] no constraints on overloading, but people generally use it in very reasonable ways.
[^1] the typeclass/trait has an interface that is enforced, but there's usually also some implied laws that the type checker can't verify for you
[^2] the big exception being comparison methods like `__leq__` which throw a runtime error if the result isn't a boolean, much to the consternation of DSL writers
- mantap 6y agoHaskell has the worst operator overloading of any language I've used. There's tons of niche operators, only some of which have names, it's so hard to Google them. Haskell should have enforced that every operator must have a `name`.
- tome 6y ago> There's tons of niche operators, only some of which have names, it's so hard to Google them. Firstly, Hoogle is your friend https://www.stackage.org/lts-17.8/hoogle?q=%3E%3D%3E https://www.stackage.org/lts-17.8/hoogle?q=%3E%3D%3E Secondly, you can Google them these days https://www.google.com/search?hl=en&q=%3E%3D%3E https://www.google.com/search?hl=en&q=%3E%3D%3E
- dllthomas 6y agoSymbolHound was invaluable, once upon a time.