News for hackers. Stuff that matters.
Re:Rust Traits Deep Dive, Part 2 by lomnakkus on Wednesday June 20, 2018 @03:54PM (#17359119)
Another way would be to use return type polymorphism. That way you could have a trait similar to Haskell's "Num a" + "Integral a" with "fromIntegral :: a" and just have the parser insert a "fromIntegral" in front of every numeric literal.

I don't know much about Rust, but I'd assume from the discussion that it doesn't support this?

Of course, Haskell's Num is a horribly broken typeclass, so don't do exactly that. :)

There are no comments on this comment yet.