The bad thing about existing nominally typed OO PLs is that you can't post-hoc let a class implement an interface. If you could add new methods to any class, and then declare that the class now implements a new interface, you'd get the practical benefits of structural typing.
-
-
Replying to @msimoni
Uh? CLOS generic functions, Haskell typeclasses, Clojure protocols, Rust interfaces, etc., have both nominal classes and post-hoc implementation. Just because Java and C++ are extremely bad languages doesn't mean the concept of nominal classes is itself deficient.
1 reply 0 retweets 1 like -
Replying to @Ngnghm
In which of these languages can I do this: add new methods to class C, declare that C now implements interface I, and now have every instance of C be an instance of I?
1 reply 0 retweets 0 likes -
-
Replying to @Ngnghm
in CLOS you'd need to redefine C with I as superclass afaict
3 replies 0 retweets 0 likes
In CLOS, you only care whether a method is defined for a given generic function, and you can do that after the fact. That said, if you somehow insist on making a class a subclass of an interface class, you can also do that retroactively using the MOP.
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
Read my blog!