Live data from Hacker News

JDK 8 Release Notes

oracle.com

241–250 of 314 posts

Re: JDK 8 Release Notes

#241
post #6
post #4

You know, I've been messing around with Java little lately. Nothing too fancy. It's actually not a bad language -- with a modern IDE it's actually pretty quick and breezy to work with. If the standard library was cleaned up and the warts were all removed and filled in, even if it broke compatibility (call it Java X or the Latte language or something) I'd be okay with that. There's too much old 90's cruft hanging arou…

>If the standard library was cleaned up and the warts were all removed and filled in, even if it broke compatibility (call it Java X or the Latte language or something) I'd be okay with that this is what groovy and kotlin attempt to do. groovy is backwards compatible with java as well, in most cases java code is valid groovy code.

> groovy is backwards compatible with java as well, in most cases java code is valid groovy code.

Whenever I read that meme I get damn suspicious about why java code isn't valid groovy code in all cases. Why only most cases? It all sounds like a recipe for spending half a day debugging simple scenarios where things don't run as intended.

To be taken seriously (or as seriously as a language called Groovy can be taken), embrace and extend Java fully, don't embrace only 99% of it before extending. That's what Microsoft tried with J++ and lost a lot of trust with developers that took them a decade to win back.

Re: JDK 8 Release Notes

#242
post #4

You know, I've been messing around with Java little lately. Nothing too fancy. It's actually not a bad language -- with a modern IDE it's actually pretty quick and breezy to work with. If the standard library was cleaned up and the warts were all removed and filled in, even if it broke compatibility (call it Java X or the Latte language or something) I'd be okay with that. There's too much old 90's cruft hanging arou…

You might want to check out Groovy. It's built on the JVM, you can use all the standard library and third party Java packages including stuff off Maven, and you can even just run straight Java code through it. However, at any time you can also drop into Groovy land, and write in a much more concise and functional style. Closures are very common (just look at anything in Gradle), it was clearly influenced by Python/Ru…

Meh, used Groovy for 2 years followed by a year of Grails 1.3.x hell.

Both the language and the framework have likely improved since then, but after switching to Scala + Play there's simply no going back ;-)

p.s. Haskell + Yesod (or Snap) look interesting as an alternative web stack to explore, but otherwise not seeing much out there that would draw me away from Scala land.

Re: JDK 8 Release Notes

#243
post #206

Earlier quoted context omitted.

Go work with C++, and you'll pine for Java.

And go work with C# and you'll pine for nothing. I've used all three and after a few years of C#, the other two are just a distant memory.

And go work with C# and you'll pine for nothing.

Except any worthwhile platform where you're not a second class citizen.

Re: JDK 8 Release Notes

#244

Earlier quoted context omitted.

Because it does not use JVM. The language is Java, but the virtual machine is Dalvik.

Why do they still use JDK 6 and not the current default version?

Because Dalvik does not support Java 8 features, and those would need to be implemented first. Java 8 was only just now released in final form.

Dalvik does have support for all Java 7 features: http://tools.android.com/tech-docs/new-build-system/user-gui...

Dalvik will most likely be replaced with ART (Android Runtime) at some point: http://source.android.com/devices/tech/dalvik/art.html

ART has been in the works for at least two years now.

Re: JDK 8 Release Notes

#245

Earlier quoted context omitted.

> It has a very complicated type system, but doesn't even allow you to express things like function composition or generic sums at the language level. Yeah, sure, it doesn't have Haskell's . or algebraic datatypes, just like lots of other languages. I'm not sure what's complicated about the Java type system, but I suspect you're trying to say you don't like subtyping. Moving on... > Its syntax is stunningly verbose (…

Checked Exceptions and null. I write a lot of Java and I generally enjoy the language, but those two things; if Oracle could fix those somehow I would be extremely pleased. I'm so tired of writing null checks and I hope Optional is not the final answer since it too can be a null due to programmer error. I am really worried about Optional getting abused in Java 8... Actually, I waffle on checked exceptions; it seems e…

+1. If only they had introduced syntactic sugars for nulls, like user?getAddress()?getStreet(). It just doesn't have to be so painful. Writing functions used to be one of them and I'm happy it's solved.

Re: JDK 8 Release Notes

#246
post #108
post #27

Earlier quoted context omitted.

I've always been reticent to learn these offshoot dialects of languages unless I really needed to. I'd much prefer it if they were treated as syntax experiments, and good ideas from them filtered back into the main language.

The problem is the rate things get filtered back to Java. I started using Groovy when I kept waiting and waiting for new language features. In 2003.

Groovy wasn't production-ready in any way, shape, or form until 2005 when the parser was rewritten in Antlr 2, and even then it took years to clean up bugs particularly those related to the MOP which was added in 2006. The Java 5 features weren't even begun to be added to Groovy until early 2006, and they're still buggy. The only significant addition to Groovy since then has been a @CompileStatic tag in Groovy 2.0 in June 2012, which its main user Grails 2.2 didn't dare bundle until 6 months later, but didn't actually use the static compilation. Grails 2.4, still in development, is the first to actually use any of the static features of Groovy, but with a strong caution in the doco: "Care must be taken when deciding to statically compile [Grails] code." http://grails.org/doc/2.4.0.M1/guide/introduction.html#whats...

Re: JDK 8 Release Notes

#247
post #35
post #30

Earlier quoted context omitted.

Groovy isn't attempting to fix Java, it's entirely different. (And it sacrifices type safety--even what of it you get with Java--and performance to do so.)

> And it sacrifices type safety Groovy is optionally typed, you can have as much safety as you wish. > and performance to do so If you use static types, you can use @CompileStatic to get most of the performance back.

Groovy's main user Grails 2.2 didn't dare bundle Groovy 2's @CompileStatic until 6 months after its release in June 2012, but didn't actually use the static compilation. Grails 2.4, still in development, is the first to actually use any of the static features of Groovy, but has this strong caution in the doco: "Care must be taken when deciding to statically compile code." http://grails.org/doc/2.4.0.M1/guide/introduction.html#whats...

Re: JDK 8 Release Notes

#248
post #222

Earlier quoted context omitted.

But without a pattern matching system, optional is still half of what it is in, say, Scala.

Isn't map/flatMap and orElse enough, if only for Optional?

It's not enough for compactly expressing imperative logic. In Scala:

  resultOption match {
    case Some(x) => println(x)
    case None => println("error")
  }
Without pattern match:

  if (resultOption.isDefined) {
    println(resultOption.get)
  } else {
    println("Error")
  }
The .get is the problem.

Re: JDK 8 Release Notes

#249
post #18

Earlier quoted context omitted.

A major cleanup of the Java libraries is scheduled for Java 9. The JVM actually does not surprise anyone who's been working with it for a while: it is downright the most performant, flexible and awesome runtime environment ever developed. I've been playing around with lots of languages and environments in my pretty long career and, in the past decade, have always come back to Java (or the JVM). It feels like driving…

The JVM has a couple of pretty significant problems when trying to work with functional-style languages. The biggest one is the way it deals with the stack: It's not in the heap, and it's pretty limited, so with something like scala, and more specifically with scalaz, you have to do some contortions to avoid overflows. 90% of usages of scalaz trampolines are nothing but ways to work around JVM limitations. I'd argue…

In Scala I work with self tail recursive functions all the time. Scala optimizes self tail recursive functions just fine, rewriting them as simple loops.

Yes you do have to use trampolines for mutual tail recursive function, because the JVM currently lacks support for it, however if you take a look at the Da Vinci sub-projects in OpenJDK, a prototype has been in the works for quite some time, led by none other than John Rose and given the attention that invokeDynamic is getting, I have no doubt that this will also happen on the JVM: http://openjdk.java.net/projects/mlvm/subprojects.html

Also, Scalaz great as it may be, it simply sucks in terms of the actual implementation, as it has loads of functionality that breaks when that shouldn't have been a possibility in the first place. Every time I happened to investigate issues related to Scalaz, I always ended up with a "WTF were they thinking" moment.

> I'd argue that today, you are better off with the .NET VM, as far as features are concerned.

That's bullshit. Speaking of tail calls optimizations, the bytecode available in .NET didn't even work at all on 64 bits .NET, prior to version 4.5 - that's right, before 4.5 the tailcall bytecode was considered more of a guideline. And Because C# doesn't use it, they never bothered to optimize it, so it has a pretty dramatic performance hit in comparison with normal function calls. And Mono probably doesn't do tailcalls properly even today, with F# being unusable on top of Mono for several years.

In terms of features - for example the CLR doesn't optimize virtual method calls. This is killing dynamic languages, or static languages that diverge from the C# OOP flavor in terms of polymorphism. IronRuby was never even close to what JRuby could do even when Microsoft was funding its development, simply by virtue of JRuby running on top of the JVM. And now ever since JDK 7 with invokeDynamic, the performance boost is so amazing at times compared to Ruby MRI, that people are running apps on top of JRuby for performance reasons ;-) The JVM for example can inline virtual method calls at runtime and can de-optimize those call sites in case invariants change or in case it notices that there are no performance benefits. This is something that really few other VMs can do.

invokeDynamic is amazing. It provides a way to override the default method resolution that the JVM does, while still benefiting from the same optimizations that the JVM does for normal method calls. It even has benefits for static languages such as Scala, for dealing with closures and Java 8 introduces a facility for initializing a value that can afterwards be treated as a constant, so there are big wins ahead for Scala in terms of performance for things like "lazy val", or structural/dynamic types and others.

Functional languages use a lot of persistent data-structures and persistent data-structures are by their nature wasteful in terms of short-term junk. You need a really good garbage collector to not suffer from this and the JVM really has the best garbage collectors available. You should see what it can do in a server-side environment with server instances being hit with thousands of reqs/sec per JVM process of real traffic. I have and it's freaking sweet.

Also, it's actually good that Java's generics aren't reified. Reification is only needed for languages like Java in which the type system sucks and stays in the way for more expressive/advanced type systems. Language implementers have to pull off a lot of tricks in order to work around CLR's reified generics. F# has 2 generics type systems in the same language, as Hindley-Milner can't be piggybacked on top of CLR's reified generics.

.NET still has some niceties, like stack-allocated value types, which is sweet if you want numbers that diverge from the standard primitives offered and to avoid boxing (and JRuby suffers a little because of this). But btw, here's another thing that the JVM can do - it can do escape analysis and for example it can decide to allocate certain short-lived objects straight on the stack if it sees that those objects don't escape their context.

Re: JDK 8 Release Notes

#250

Earlier quoted context omitted.

You have probably encountered the occasional Java desktop app, without realising. If you can't easily tell it is Java, the development team have done a good job. Two of my company's three products are a Java desktop app for Mac, and they look and feel like typical Mac apps. Best practice? IMO you should spend significant time on the GUI making sure it feels native. Otherwise, Swing is still about as good as it gets f…

Java as a desktop front-end language is dead. Sorry. JavaFX is a sad attempt at trying to re-live it, and no one outside of enterprise environments that are pure JVM shops are attempting to use it.

it's just pining for the fjords.

More seriously, as a recent example you will find that what bitcoin.org offers you as the first option for a wallet (multibit) is written in java.

That may not be mainstream, but it's definitely not the classic enterprise java shop.

Post reply on HN