3 ms·
I understand what it is. I don't see the need of it if you already have a class-based system. Go uses structural typing. But it is the only thing they have. R
by dmacvicar 12y ago
I understand what it is.
I don't see the need of it if you already have a class-based system.
Go uses structural typing. But it is the only thing they have. Rust has traits, and it is the only thing they have.
I can't think now of more stuff but I remember you could even write xml in the language.
- frowaway001 12y ago> I don't see the need of it if you already have a class-based system. Like in Java? new Object() { void foo() {}}.foo(); // Works Ooops. The point about XML is so stale already that I won't even bother commenting on it.
- dmacvicar 12y agoYou seem to be stuck in the topic of how useful structural typing is. Which I agree with.
- frowaway001 12y agoEh what? No. I couldn't care less about structural types. I care about simple, consistent rules. "X is a type, you can use it wherever you want" is one. "X is a type, but there is also Y, which you can't really express in position A and B unlike X, but can only use it if you carefully avoid doing things #1 to #4" isn't one.
- dmacvicar 12y agoI agree with partly with you. I don't think it helps for consistency when you have to ask yourself why some functionality is defined in terms of a trait if it could be defined in terms of the structural type and just providing the methods would be sufficient.