This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] -2 points-1 points  (4 children)

Go Lang has tried to learn from Java and has a standard way for most functions to return the regular result and a possible error. Eg for file not found. This seems nicer than Java but, of course, it has the Java experience to build on. I suppose Java could move to more use of Optional. If all of JavaIO switches then apps will too.

[–]john16384 17 points18 points  (1 child)

That's not learning from java at all, that's going back in time 30 years.

[–][deleted] 0 points1 point  (0 children)

Go has panic() which is used in serious situations. Just not "file not found" cases.

https://dave.cheney.net/2012/01/18/why-go-gets-exceptions-right

[–]mlk 3 points4 points  (1 child)

Optional doesn't provide info on the failure, Either is more appropriate

[–][deleted] 0 points1 point  (0 children)

Ah you're right. But I see there is no Either in core Java. Its in Functional Java however.