4 ms·
> Java is missing basic tools for abstracting idioms Such as?
by apta 7y ago
> Java is missing basic tools for abstracting idioms
Such as?
- marcosdumay 7y agoAny kind of flexibility on the syntax, metaprograming, reflection is so useless that it could as well not be there, high order constructions where the compiler can infer the idiom, well, really anything. It has relatively recently gained usable high order functions, and seems to have stopped there.
- apta 7y agoCould you point out specific use cases? Are you referring to lisp-like macros? Constructs like Higher Kinded Types? I'm just trying to understand where you're coming from.
- marcosdumay 7y agoWell, I'm saying that Java doesn't have any of those. Other languages have some concept they run away with, like macros for Lisp, monads on Haskell, named parameter enumeration and monkey patching on Python. Even PHP relies heavily on object enumeration. All of those techniques are kind of equivalent in power, spread through a curve trading flexibility (expresivity) with organization (possibility of analysis). Java has nothing near that curve.
- apta 7y agoI'm not sure what you mean by named parameter enumeration or object enumeration to be honest. > spread through a curve trading flexibility (expresivity) with organization (possibility of analysis). Java has nothing near that curve. Java definitely leans towards the organization part of the curve. It doesn't need a single concept to run away with, because it knows that there is no magic bullet that will solve everything. Monkey patching is dangerous, especially when you're programming large systems that end up being used in finance or ecommerce. On a side note, if I'm not mistaken, Brian Goetz mentioned that something similar to higher kinded types was not off the table for Java sometime down the line in a recent panel.
- marcosdumay 7y agoDo I see a case of the Blurb? I'm not sure, but it does resemble it. (By the way, you'll have a hard time finding any site written on Python that doesn't use monkey patching, e-comerce or not). Anyway, parameter or objects enumeration are when a library uses both the field names and their values as input, people use them to define DSLs on a function call or object construction. Parameter enumeration does afford applicative semantics, but (mutable) object enumeration affords full monadic semantic, so it's easy to construct Turing complete DSLs (and I guess, why Python people avoid it). It is really hard to explain how those concepts are useful, mostly because they only work when everything else on the language help. If you try them on Java, they will be mostly useless. C# for example has a fully generic implementation of monads, with specialized syntax that isn't very far from Haskell's, do notation. Yet, with its bad type inference and the inflexible interface hierarchy it got from copying Java, it is nowhere near as useful.