News for hackers. Stuff that matters.
Re:Java Is Unsound: The Industry Perspective by lacampbell on Tuesday January 24, 2017 @07:00PM (#13477050)
How is it better? All you've done is re-implemented mapping over an option. Your C# code is this in Java:

    String id = order.map(o -> o.Customer).map(c -> c.Id).orElse("INVALID");
The Java code is actually shorter and works straight out of the box, so I don't know why you're calling Optionals "verbose".
Re:Java Is Unsound: The Industry Perspective by tigershark on Wednesday January 25, 2017 @04:04AM (#13479891)
The null check operator is much more concise than my pre-c# 6 solution. Moreover you can apply both my solution and the null check operator to any type, while for Java you have to specify that a field is optional (increasing the verbosity and moving the responsibility to who write the class) and you can't do it for types that you don't own. So for these types the only way is to create a wrapper type just to add the optional fields, and this brings the amount of boilerplate code through the roof. So, just to sum it up, contrary to what you say the c# solution works out of the box, is much shorter than the Java alternative and works for every type. Honestly I can't really see why Java solution is superior for you.
Re:Java Is Unsound: The Industry Perspective by vile on Tuesday January 24, 2017 @10:38PM (#13478249)
It's not shorter than out-of-the-box c# 6, which would be var id = order?.Customer?.Id ?? "INVALID";

I think that was the point he was making, that it's always been possible, and now is simple.

Re:Java Is Unsound: The Industry Perspective by lacampbell on Tuesday January 24, 2017 @11:37PM (#13478569)
Except that nullable types aren't the same thing as option types, so it's not doing the same thing. Nullables are much weaker than options. You can't do this for instance:

    string? id = "Name";
While you can do stuff like this:

   int x = 0;
   int? y = x;
Again, F# has nullable types and options, and the fact that no one in F# uses nullable types should tell you something.