News for hackers. Stuff that matters.
Re:Go's power is in emergent behavior by eridius on Sunday April 27, 2014 @02:39AM (#7654196)
This is similar to how Rust works. You can implement new traits (which are what Rust calls interfaces) on pre-existing types. The rule is that either the trait or the type must be defined in the current crate (e.g. in the current library).

This means that my library can define a new trait and implement it on, say, int. Or I can define a new type and implement a pre-existing trait on it. But it prevents me from implementing pre-existing traits on pre-existing types, which is important for the compiler to be able to answer the question "does type A implement trait B" without having the answer change when a new library is linked.

Re:Go's power is in emergent behavior by ori_b on Sunday April 27, 2014 @04:49PM (#7656795)
I do not have that restriction; Traits are instead scoped by module, so a trait implementation in one module is not necessarily available in another, unless it is exported explicitly. Now, on the other hand, I doubt Rust has the same kind of bugginess I have :)