5 ms·
functional, oop Do these have any intersection except Scala?
by duck2 10y ago
functional, oop
Do these have any intersection except Scala?
- brianwawok 10y agoF#
- Sharlin 10y agoDepends on how exactly how functional you want to go, but latest versions of C++, Java, JavaScript, and C# definitely qualify. Rust, too, though it's not strictly OO. And Python, Ruby, Swift.
- belovedeagle 10y agoIf Rust is OO then the term is meaningless. No inheritance; dynamic dispatch only via explicit indirection (Boxed traits); methods are (therefore) just syntactic sugar for regular functions.
- jjnoakes 10y agoI disagree; with encapsulation, polymorphism, and composition, Rust seems OO enough to not make the term "meaningless". At least, not according to the widely used definitions I've read of OO.
- belovedeagle 10y agoAll of these things are found in Haskell as well; it's not OO by any stretch of the imagination. You're confusing "oop language" with "modern programming language".
- jjnoakes 10y agohttps://arxiv.org/abs/cs/0509027 https://arxiv.org/abs/cs/0509027
- qznc 10y agoLisp CLOS does not have inheritance for methods either, but is OO by definition. Imho, OO is about polymorphism [0] and Rust provides that. [0] http://beza1e1.tuxen.de/articles/oop.html http://beza1e1.tuxen.de/articles/oop.html
- belovedeagle 10y agoRust fails many of the other tests mentioned. As for polymorphism, is Haskell OO? If so, then I think my claim that the term is meaningless is justified.
- qznc 10y agoThis is the punch line. Once you have a definition of OO, which fits all languages usually considered OO, the definition also fits Haskell. :)
- dfox 10y agoCLOS effectively does have inheritance for methods because for sane specializers subclass matches everywhere where it's superclass matches. One can in fact view the CLOS mechanism of specializers and effective-method composition as more flexible mechanism for inheritance than traditional implementations of OOP.
- lispm 10y agoCommon Lisp has inheritance of methods, but it does not work on a class hierarchy directly. When a generic function gets called, the applicable methods are being ordered based on the classes of the arguments - not just one argument, but possibly many. A more specific method can call the next method. In some cases this is done automatically. This is inheritance, based on the class hierarchy. CLOS also allows the developer to implement other inheritance mechanisms, by developing his own way to combine the methods of a generic function.
- bad_user 10y agoIf Rust is FP then that term is meaningless too ;-)
- agumonkey 10y agoDoes OCaml counts ? the OO layer is actually pretty interesting.
- stass 10y agoAnd don't forget Erlang as well.
- jahewson 10y agoOCaml, which is now 20 years old. The "O" was originally for "Objective".