On 9/17/13 4:34 AM, Gokcehan Kara wrote:
I haven't used Haskell much but I know a little bit of Scala. In Scala you need to be explicit because generics are compiled once to run with different types. As far as I understand, rust compiles different copies for each type (monomorphizing?) just like C++ so it might be possible to be implicit in rust as well.
As Felix said, error messages are a big part of it, but there's also another equally important reason: scoping of methods. Without explicit bounds it's hard to get the scoping right: the basic problem is that the generic function is calling methods it doesn't "know about" at the time of definition, so it can't import them from anywhere. This is why C++ needs Koenig lookup/argument dependent lookup, which comes with its own host of problems. Explicit bounds avoid this issue.
Patrick _______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
