4 ms·
Algebraic data type http://en.m.wikipedia.org/wiki/Algebraic_data_type http://en.m.wikipedia.org/wiki/Algebraic_data_type
by silentOpen 14y ago
Algebraic data type
http://en.m.wikipedia.org/wiki/Algebraic_data_type http://en.m.wikipedia.org/wiki/Algebraic_data_type
- neilk 14y agoWhich is t3h awesome, but not an option in either language under consideration, as far as I know. Unless you used a Haskell-to-JS compiler. I apologize if I implied that static typing = Java's kind of typing.
- silentOpen 14y agojs_of_ocaml http://ocsigen.org/js_of_ocaml/ http://ocsigen.org/js_of_ocaml/
- noblethrasher 14y agoJava doesn't have pattern matching or nice tuple syntax but it does have Algebraic Data Types. Abstract classes are sum types (the dervived classes are the variants) while interfaces are (awkward) product types.
- klodolph 14y agoIt's not the interfaces that are product types, but the concrete classes which correspond to product types. Interfaces are a different concept. In functional programming, an implementation of an interface would extend the domain of polymorphic functions that use that interface. The same can be said about Java, if you tilt your head funny and don't need to communicate with other Java programmers, and if you only care about single argument dispatch.