4 ms·
I have a different impression. I have the feeling that the Java language itself stucks in it's original idioms. If there would not be other languages on the JVM
by ktpsns 6y ago
I have a different impression. I have the feeling that the Java language itself stucks in it's original idioms. If there would not be other languages on the JVM, such as Kotlin, Graal.* or Clojure, I guess the Java ecosystem would percieve a long starvation/death.
My impression is that languages such as JavaScript and Go gain more and more track for enterprise software stacks. They are much more multi-paradigm at heart then the Java language could be. I wonder why Java doesn't learn from C++, which reinvents itself every few years. The lambda notation in C++ is really a thing Java could easily have.
- wwright 6y agoJava added lambdas in Java 8. Are you thinking of something else?
- twic 6y agoIndeed, Java's notation for lambdas is marginally better than C++'s, where you have to use braces and an explicit return even for tiny lambdas.
- Arcsech 6y ago> The lambda notation in C++ is really a thing Java could easily have. Java has had lambda expressions, with what I would describe as cleaner syntax than C++'s, since JDK 8. Is there something I'm missing that C++'s have over Java's? This has also lead to a lot of Java becoming much more functional, see especially the Stream API[0] (also added in JDK 8). I would say it's much, much easier to write functional-style code in Java than it is in Go. [0]: https://docs.oracle.com/javase/8/docs/api/java/util/stream/Stream.html https://docs.oracle.com/javase/8/docs/api/java/util/stream/S...
- vbezhenar 6y agoStream API is bad example of design IMO. Checked exceptions are not integrated (even if I don't like them, they're part of the language and are not going anywhere soon it seems). Simple operations require lots of ceremony (list.map(x -> x + 1) vs list.stream().map(x -> x + 1).collect(Collectors.toList())). Also Java lambdas can't change outer variables, so one have to resort to old tricks with one-item arrays. Java lambdas are just syntax sugar for anonymous class from language point of view. They're implemented differently under the hood, but they don't bring anything new to developer, they just save few lines of code which is nice, but could be much better.
- kelnos 6y ago> Also Java lambdas can't change outer variables, so one have to resort to old tricks with one-item arrays. On the rare occasion that I need to do this, I usually find that I'm thinking about the problem the wrong way and there's a much clearer way to write it than messing with mutable variables outside my closures.
- fomine3 6y agoTend to so but it depends on situation.
- nobleach 6y agoEven though there is a book on Functional Programming in Go, I'd say, the entire idea really bends the language into an odd shape. Certainly one could implement map/reduce/filter (I think Rob Pike actually did create examples on his GitHub at one point), but the idiomatic paradigm of Go isn't FP. It's definitely not hard to beat in that arena! Now Kotlin or Scala on the other hand....
- carimura 6y agoThings are innovating faster than ever, but, the trick is always to address the challenges of both today and tomorrow, while staying true to compatibility and stability. Check out Brian's talk on Stewardship: https://www.youtube.com/watch?v=2y5Pv4yN0b0 https://www.youtube.com/watch?v=2y5Pv4yN0b0
- specialist 6y agoThe problem with metaprogramming, multiparadigm, and so forth, is other people. I kid! My bro is a C++ partisan. We've been arguing about this for 25+ years. Every time I'm about to use my crushing grip of reason to submit him, he wiggles free. He's made a pretty good career from fighting misc compilers over the years. So who am I to judge?