News for hackers. Stuff that matters.
Re:The Next Step for Generics by karmakaze on Tuesday June 16, 2020 @05:07PM (#23544127)
I'm not aware of any current Java project on Sum types. There is multi-catch for exceptions but no immediate plans I know to use elsewhere.
Re:The Next Step for Generics by apta on Tuesday June 16, 2020 @05:10PM (#23544160)
A form of pattern matching and switch expression has already made it to the language as of JDK 14. Those are paving the way for full blown pattern matching and sealed types:

https://cr.openjdk.java.net/~briangoetz/amber/datum.html

https://openjdk.java.net/jeps/360

Re:The Next Step for Generics by richardwhiuk on Tuesday June 16, 2020 @05:29PM (#23544437)
Java aren't fixing nulls, IMHO. They are making it worse.
Re:The Next Step for Generics by apta on Tuesday June 16, 2020 @05:39PM (#23544553)
How are they making it worse?

In any case, there already exist solutions in place:

https://checkerframework.org/manual/#example-use

https://github.com/uber/NullAway

Re:The Next Step for Generics by richardwhiuk on Thursday June 18, 2020 @12:56PM (#23565053)
The code ends up looking like:

  Optional<Integer> foo;

  //....

  if (foo != null) {
      foo.and_then(new Consumer () {
            function accept(Integer foo) {

            }
      });
  }
Re:The Next Step for Generics by karmakaze on Friday June 19, 2020 @03:04PM (#23577810)
I would never assign null to an Optional nor use a library that returned one.

To ensure assignment before use make it final.