Hacker News new | past | comments | ask | show | jobs | submit login

> 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.




You seem to be stuck in the topic of how useful structural typing is. Which I agree with.


Eh 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.


I 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: