can I implement a trait for a third party type?
Am I right in my understanding that I can’t implement a trait I control for a type that I don’t control? For example I couldn’t implement a trait requiring an addition operator for any built in integer types? This is a point of difference with Rust traits and Haskell type classes?
2 Replies
You're correct. You cannot currently implement a trait for a type that you don't control. The team fully intends to fix this, but there are a couple of possible approaches (for example, allowing implicit conformance to traits, or an extension mechanism like Swift (in Rust, adding an implementation I think). Stay tuned.
That’s great — Mojo is looking better and better. Thanks to all involved!