5 ms·
> Haskell has what it calls types I think you mean typeclasses? One of the things that always bothered me about interfaces was the inability to define a defau
by ryanatkn 12y ago
> Haskell has what it calls types
I think you mean typeclasses?
One of the things that always bothered me about interfaces was the inability to define a default implementation, especially when developing UIs. A proper mixin system (like what's used by React's components) has solved this particular problem for me.
- neilk 12y ago> typeclasses? Fixed. Thanks. I agree with you about Haskell. I almost went into a discussion of how Rust does this. They don't have subtypes, but they do have code reuse if you explicitly declare it. Caution, I'm just an admirer of Rust, not a user. So maybe it sucks too, but this seems closer to how things ought to be. http://static.rust-lang.org/doc/master/tutorial.html#default-method-implementations-in-trait-definitions http://static.rust-lang.org/doc/master/tutorial.html#default...
- tel 12y agoHaskell does allow you to define default implementations, though. In at least two different ways.
- cpeterso 12y agobtw, Rust will likely add virtual functions with inherited implementations because it makes some Servo code easier to write and more efficient: https://mail.mozilla.org/pipermail/rust-dev/2014-March/008952.html https://mail.mozilla.org/pipermail/rust-dev/2014-March/00895...