5 ms·
> Java finally gets what's been available in ... and others for a very long time You seem to think that the goal is to get as many features as possible, as qui
by pron 7y ago
> Java finally gets what's been available in ... and others for a very long time
You seem to think that the goal is to get as many features as possible, as quickly as possible. Maybe some languages have that goal, but Java's design philosophy -- from its inception [1] -- has been to be a conservative language that only adopts features that have become familiar to programmers and stood the test of time in providing a good cost/benefit. Java hasn't always done this, but that's the aspiration. Worked out pretty well, I think.
Given Java's design philosophy, the far more interesting question is which features of those more adventurous languages Java does not intend to adopt.
> Java compiler/VM, when it sees the patterns "somevar" and functions "getSomeVar" and "setSomeVar" doing purely getter/setter stuff, removes the actual function calls and silently changes them in the background to field lookups for speed. If you attach a debugger or memory profiler, is changes them back to functions and slows them down.
It's true, and the optimizing JIT compiler does much more than just that. It performs deep speculative optimizations, like inlining virtual calls and removing untaken branches, reverting them (using a process called deoptimization) either for debugging or when it detects its assumptions are false. What you're referring to is just an instance of inlining.
[1]: https://www.win.tue.nl/~evink/education/avp/pdf/feel-of-java.pdf https://www.win.tue.nl/~evink/education/avp/pdf/feel-of-java...
- tomcam 7y ago> deep speculative optimizations my new blog title
- Cladode 7y agoWorked out pretty well, I think. Au contraire mon ami! ML was better than most of its successors, including Java, which held programming back. Milner's ML avoided some of Java's glaring mistakes (e.g. exception specifications, lack of generics, non-uniform treatment of types, lack of higher-order functions, lack of pattern matching) from the start. Xavier Leroy showed how efficiently to compile ML in the 1990s. The main thing ML lacked (w.r.t sequential computing), was a good integration with OO and HKTs. That was solved by Scala.
- pron 7y agoI meant that it's worked out pretty well for Java. ML -- one of my favorite languages, alongside Java and a couple of others -- has also managed to avoid being used by anyone, really. But look at Java now: it has generics and higher-order functions, and it's getting a uniform treatment of types (Project Valhalla), and pattern matching [1]. And so while ML introduced those features in a research context, Java is the language that has made and will make the world actually use them. Being ahead of your time is often just as much of a mistake as being behind (as far as product design goes). As to the question of "holding programming back," it is yet to be seen how much of an impact these features have in practice. Same goes for what ML "lacked." I personally like some features more and some less, as do you, but I don't think anyone knows which programming language features really push programming forward. [1]: https://cr.openjdk.java.net/~briangoetz/amber/pattern-match.html https://cr.openjdk.java.net/~briangoetz/amber/pattern-match....
- AnimalMuppet 7y ago"Holding programming back" means that it would have advanced in the absence of Java. What language would have advanced it? Cladote seems to assume that ML would have, which would have been actually used if Java hadn't taken over the world. That seems unsupported by evidence. Overly optimistic, as well. And if Cladote's answer, ML, would not have taken over, then did Java hold back anything? No. Was it better than, say, C++? For many uses, yes. "We would have ruled the world if it wasn't for you meddling kids!" is wishful thinking. If ML was so good, it should have won anyway. Instead, "has managed to avoid being used by anyone" is a pretty fair assessment.
- Cladode 7y agoIf we collapse the two concepts of - best possible X - most popular X are we loosing possibly interesting perspectives on X?
- pron 7y agoI don't think AnimalMuppet is confusing most popular with best. But as you don't have the data required to conclude which language is better by any meaningful metric, anyway, then your claim is just wishful thinking. If ML had won and Java lost, one could have just as easily said that ML was holding programming back from some imagined benefit Java would have brought. I think that it is you who are confusing "an interesting perspective" with a value judgment. Yes, ML had pattern matching before Java, while Java had pervasive dynamic linking and dynamic code loading. Those are simple facts and perhaps "an interesting perspective," but how do you decide which is better?
- agumonkey 7y agoJava inertia was also a side effect of its market. It was big corps which were used to slow and bloat. But Oracle seems to have changed to follow the more hectic pace of web 2.11 era.