▲ | pyrale 3 days ago | |||||||||||||
The instance could be defined in module c. | ||||||||||||||
▲ | zk4x 3 days ago | parent [-] | |||||||||||||
Perhaps I should have been more clear. The point is you would not implement traits. You would just implement functions. You would not implemet traits, you would just write functions iter and len for your type. When calling a function, compiler would check separately for existence of each function defined in the trait. That is a trait would be just like any other type alias so that you do not need to repeating complex function names everywhere: You could write:
but that would be just syntactic sugar for this:
Basically removing traits alltogether, just relying on functions. | ||||||||||||||
|