Live data from Hacker News

JDK 8 Release Notes

oracle.com

251–260 of 314 posts

Re: JDK 8 Release Notes

#251

Earlier quoted context omitted.

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

Why would you ever pattern match on Option[T] in Scala? In all my code, I do either: optionalF.map( _.whatever ).getOrElse(fallback) or perhaps (optionalF optionalFallback).getOrElse(finalFallback) For those unfamiliar with , see here: http://www.chrisstucchio.com/blog/2014/handle_failure_with_p...

I think that's a pretty extreme position. First, it will run a lot slower than the pattern matching alternative:

    optional match {
      case Some(x) => whatever(x)
      case None    => fallback
    }
Second, I find the pattern matching code much clearer. Sure, it's also longer, but clarity trumps everything.

Re: JDK 8 Release Notes

#252

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…

FWIW, I have found using findbugs and @Nullable/@NotNull to be a blessing.

Re: JDK 8 Release Notes

#253
post #173

Earlier quoted context omitted.

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…

I'm so tired of writing null checks ... Could the null checks of Java be compared to the ones used in C#? My C# code is often littered with ternary operators to deal with null values. And that's still not as safe as the Objective-C approach where one can just send messages to nil[0] which is really awesome imo. I guess I kinda wonder if I could avoid the null checks in C# somehow ... I figured using a design by contr…

> not as safe as the Objective-C approach where one can just send messages to nil[0] which is really awesome imo.

It's definitely NOT awesome. This stupid behaviour causes bugs all the time as you think you're doing an action but it's actually a no-op because something else failed and you get a nil. An NPE is awesome - it crashes immediately and you know exactly what is wrong. A silent no-op is the worst thing to debug.

Re: JDK 8 Release Notes

#255
post #194

Earlier quoted context omitted.

Java is not a bad language. It was written as a reaction to C++ - a simpler, more consistent systems programming language. In that regard it has been wildly successful. It doesn't really look like a dynamically typed scripting language because it was never trying to be one. You pick a bunch of language flavour / syntactic sugar and say that Java is bad because it doesn't have those. Personally I like it because it do…

This. I realize the perl people love to have twenty different ways to do everything, but when I'm trying to get maintainable code out of an average team of programmers I don't mind the verbosity and I don't mind the lack of cryptic language features. The original java architects took operator overloading and the macro preprocessor out for a reason - you can end up with orders-of-magnitude more ugly code if those feat…

I was a C++ programmer for a very long time (and a C programmer for a long time prior to that). The abuses of 'helpful' features like operator overloading that I saw in C++ code would be enough to make a grown man cry.

Re: JDK 8 Release Notes

#256

Earlier quoted context omitted.

It's awesome and other tools (bundler) are copying it or build on top of it (gradle, buildr, Ivy repo). XML is horrible, not Maven. Python tools don't even come close. Ditto with .NET NuGet. Find me a tool that can compare feature by feature with Maven and still relevant for a long time.

I've always said: "With Java plus XML, you can have one language for the price of two." With Java, you write a lot of syntax to get static typing, but it's worth it because static typing! Then you throw static typing away (because now it's to restrictive I suppose?) to use XML files which must be structured a certain unpredictable way or you'll cry at the traceback you receive, and pray your imminent Google search ca…

Nobody with any sense uses XML in Java anymore. Everything uses annotations now.

Re: JDK 8 Release Notes

#258

Earlier quoted context omitted.

I don't think you can become a popular cross platform systems programming language without being pretty decent.

There is a lose correlation between quality and popularity, but being the most popular language is in no way indicative of being the best language (as the person I responded to was saying).

Well I guess the problem with "best" is that you have to ask: best for what? Looking pretty? Running fast? Being elegant? Being maintainable? Getting Shit Done(tm)?

Yeah, it's a kinda vacuous statement I guess :o)

Re: JDK 8 Release Notes

#260

Earlier quoted context omitted.

Why would you ever pattern match on Option[T] in Scala? In all my code, I do either: optionalF.map( _.whatever ).getOrElse(fallback) or perhaps (optionalF optionalFallback).getOrElse(finalFallback) For those unfamiliar with , see here: http://www.chrisstucchio.com/blog/2014/handle_failure_with_p...

I think that's a pretty extreme position. First, it will run a lot slower than the pattern matching alternative: optional match { case Some(x) => whatever(x) case None => fallback } Second, I find the pattern matching code much clearer. Sure, it's also longer, but clarity trumps everything.

map / getOrElse is standard in all the Scala code I've seen. Abstracting over the monad is also a pretty big win that has made some big refactorings painless for me. Pattern matching is really only used by beginners IME.
Post reply on HN