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

That's basically true. Languages that use interfaces with structural typing are significantly easier to work with though. You can "implement" an interface implicitly by just having matching fields



This means you can't use interfaces as tags, which is a very important feature (e.g. see how it's used in Rust). It also means that you have several different types implementing your interface "by coincidence", making it difficult to use an IDE to find out the types of interest, not to mention what sorts of bugs might result because of this.

There are better solutions like what Kotlin and Scala use (and potentially C# in a future version).


JS solves the tagging issue using "symbols". They're extremely weird at first look but they're basically around for that reason.




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

Search: