News for hackers. Stuff that matters.
Re:Red and blue functions are a good thing by kaba0 on Monday April 26, 2021 @07:11AM (#26941312)
Just a note, Java will also avoid function coloring very soon with Project Loom.
Re:Red and blue functions are a good thing by esfandia on Monday April 26, 2021 @09:10AM (#26942133)
The original red/blue article said that Java /didn't/ have function coloring, and that's because it didn't rely on callbacks but rather on threads. Project Loom may in fact be introducing function coloring if I understood the article correctly.
Re:Red and blue functions are a good thing by vips7L on Monday April 26, 2021 @09:40AM (#26942371)
No loom will not be introducing it. It's exactly what the team DOES NOT want. pron even stated it in his "State of Loom" article.

"Project Loom intends to eliminate the frustrating tradeoff between efficiently running concurrent programs and efficiently writing, maintaining and observing them." [0]

http://cr.openjdk.java.net/~rpressler/loom/loom/sol1_part1.h...

Re:Red and blue functions are a good thing by _old_dude_ on Monday April 26, 2021 @07:32AM (#26941414)
for sync vs async, yes !

but Java still have checked exceptions which is also a form of coloring.

Re:Red and blue functions are a good thing by kaba0 on Monday April 26, 2021 @08:06AM (#26941634)
Yeah, you are right! Though I think not every function coloring is necessarily bad and while Java’s implementation of checked exceptions have some edge cases, I think the idea itself is sound and it’s better to have it supported at a language level instead of recreating it with some meta-language in terms of Maybe/Result types, that loose extra-linguistic information like stack traces (yeah I’m sure they can be included, but that should be the default working).
Re:Red and blue functions are a good thing by _old_dude_ on Monday April 26, 2021 @09:06AM (#26942098)
You can have exceptions like in Erlang, OCaml, C#, Kotlin which all keep the stacktrace without having checked exceptions.

If you take a look to the history of Java, checked exceptions was there since the beginning but were weaken several times, first by the introduction of generics+inference (a type parameter can not represent an union of exceptions) then by the introduction of lambdas, the type of a lambda (the function interfaces in Java lingo) used by the standard lib, do not declare checked exceptions.

It's so bad that IOException, the king of checked exception, has two unchecked dual defined by default, UncheckedIOException and IOError that are raised randomly by the new APIs like java.nio.file.Files that do not want to deal with the complexity of checked exceptions.

Java has a checked exception problem but it does not want to recognize it.

BTW, there is another coloring in Java which is primitive vs object, but at least this one is recognized as an issue (see OpenJDK project Valhalla).

Re:Red and blue functions are a good thing by closeparen on Monday April 26, 2021 @02:34PM (#26946194)
I've been hearing this for what feels like 10 years. Are the close to upstreaming now?
Re:Red and blue functions are a good thing by kaba0 on Monday April 26, 2021 @02:55PM (#26946502)
It started in late 2017.

But it already works well, you can try it on the project’s branch. But there is no official timeline, it will be ready when it’s ready.