3 ms·
It's called type inference: https://doc.rust-lang.org/rust-by-example/types/inference.html https://doc.rust-lang.org/rust-by-example/types/inference.ht...
by lights0123 6y ago
It's called type inference: https://doc.rust-lang.org/rust-by-example/types/inference.html https://doc.rust-lang.org/rust-by-example/types/inference.ht...
- Phlogistique 6y agoI 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: '*'