2 ms·
I don't think that's what the parent comment is pointing at. What's throwing him off is static method dispatch based on type inference on the return value. Ha
by Phlogistique 6y ago
I don't think that's what the parent comment is pointing at.
What's throwing him off is static method dispatch based on type inference on the return value.
Haskell, for example, does this too:
class Foo a where foo :: a
instance Foo Integer where foo = 3
instance Foo Char where foo = '*'
foo1 :: Integer
foo1 = foo
foo2 :: Char
foo2 = foo
main = do
print foo1 -- prints: 3
print foo2 -- prints: '*'