4 ms·
I agree. This gets at the real distinction between one language and another; which patterns have been elevated to the status of a statement, expression, control
by fierro 6y ago
I agree. This gets at the real distinction between one language and another; which patterns have been elevated to the status of a statement, expression, control structure, or keyword. class in Java is a formalization of the OOO pattern, for example.
There's nothing you can do with OOO that you can't without it, and vice-versa. At the end of the day all we have are instructions and data.
- ywei3410 6y agoI think this sort of reduction is lazy in terms of design for language semantics; there's a massive difference in expressiveness between languages and to pretend otherwise is to do a disservice to the rich field of PL theory. Even when you elevate a particular construct to be first-class in a language; the expressiveness of languages differs greatly. For example, prior to lambdas, first-order functions existed in Java in the form of static methods - but higher-order functions weren't really possible. Even now, we lack the ability in Java to express certain forms of functions which are possible in more expressive functional languages. Lisp's in general have the same control constructs as many imperative languages, but it's possible to do higher-order abstractions over them through the use of macros and constructs like shift/reset or call/cc and the fact that everything is a s-expression. In this regard, Java and C-like struct pointers are almost first-order OOP languages - the composition via inheritance is quite frankly poor compared to the other paradigms.
- imtringued 6y ago> higher-order functions weren't really possible I see you have never used Swing. The reality is that when you needed a callback there were interfaces with a single method and you created anonymous classes that implemented that callback and its method. It's clunky but it's equivalent to higher order functions.
- ywei3410 6y agoI've used more Java enterprise frameworks than you can shake a stick at; I started with Java 1.4 mostly so I'm certainly aware of those patterns! Whether they are "equivalent" depends on your definition of equivalency. Could Java pre-SAM claim to have first-class functions; I would argue not because there was a separation between methods and classes - even though you could make a case that by having `Callable` or whatever anonymous classes you could use to emulate similar behaviours. Does Haskell have inheritance? No, but you can emulate some parts of it with a mixture of template haskell, record types and lenses.