News for hackers. Stuff that matters.
Re:The Next Step for Generics by apta on Tuesday June 16, 2020 @04:31PM (#23543696)
> having implicit nulls (C, C++, Java, JS, C#),

> lack of proper sum types (C, C++, Java, JS)

Incidentally, Java and C# have addressed (or are in the process of addressing) both issues. Both languages/platforms are superior to golang in almost every conceivable way.

Re:The Next Step for Generics by matwood on Tuesday June 16, 2020 @05:32PM (#23544476)
I've used a lot of Java and C#, and a decent amount of Go. I'm not sure I would call Go inferior. The design goals were different. I'm also not a language wonk, so maybe that's why I enjoy the relative simplicity of Go. The developer loop of code, run, code is very fast, and the standard library is good out the box. I just want to write code and get stuff done. To that end, Go is another capable, workman type language (like Java or C#).
Re:The Next Step for Generics by hactually on Tuesday June 16, 2020 @09:13PM (#23546533)
Neither have addressed it though - they do have works in progress. Same as the lack of decent threading in Java.

It's been a WIP for years. Lets judge based on status quo rather than being disingenious.

Re:The Next Step for Generics by vips7L on Wednesday June 17, 2020 @12:23AM (#23547767)
How does Java not have decent threading? Go doesn't even have actual threads.

I'm assuming you're talking about goroutines aka virtual threads/fibers whatever which are entirely different from actual threads.

Re:The Next Step for Generics by hactually on Wednesday June 17, 2020 @12:43AM (#23547882)
apologies, but yes, you're correct - I was referring to green threads
Re:The Next Step for Generics by SureshG on Friday June 19, 2020 @12:58PM (#23576347)
Hopefully will preview in next release (6 months release cycle) http://cr.openjdk.java.net/~rpressler/loom/loom/sol1_part1.h...

EAP build - http://jdk.java.net/loom/

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.

Re:The Next Step for Generics by spion on Tuesday June 16, 2020 @06:14PM (#23544942)
Except for green threads.
Re:The Next Step for Generics by erik_seaberg on Tuesday June 16, 2020 @07:29PM (#23545626)
That's true though Project Loom is working on fibers. There's already an early access release to test.
Re:The Next Step for Generics by pgwhalen on Tuesday June 16, 2020 @09:18PM (#23546564)
Minor point, they've settled on the name "virtual threads" instead at this point.
Re:The Next Step for Generics by balfirevic on Tuesday June 16, 2020 @06:39PM (#23545174)
Sum types are not planned for C# 9, are they?
Re:The Next Step for Generics by apta on Tuesday June 16, 2020 @09:05PM (#23546465)
It has pattern matching, but not a full discriminated union implementation yet. That seems to be on the roadmap though:

https://github.com/dotnet/csharplang/issues/113

https://github.com/dotnet/csharplang/issues/485