Feature request that'll never happen: Traits

I think you’re missing the point. Interfaces are contracts. They don’t have logic of their own. What good are properties and events without logic? Traits are what you’re looking for in this context. Again, other languages have not made the mistake of mixing the two concepts, and I don’t think Xojo should either.

One of the key differences with a trait is being able to access overridden methods. If the implementor has a method that matches the trait, the implementor gets priority. If you want to access the trait’s version of the method, casting would be used. Since an interface is just a contract, the interface doesn’t have an implementation that can be called. Unless you’re talking about also allowing interfaces to have method implementations, which I think is a bad idea.

1 Like