LWN.net Logo

No thanks.

No thanks.

Posted Nov 9, 2012 8:08 UTC (Fri) by ekj (guest, #1524)
In reply to: No thanks. by HelloWorld
Parent article: Haley: We're doing an ARM64 OpenJDK port!

While I agree with much of your critique, you're being overly harsh on him on one point.

Here's what he said:

"I think the reason programmers in C/C++/Java style languages have been attracted to exceptions is simply because the syntax does not have a concise way to call a function that returns multiple values"

Notice that's he's talking of the *syntax*, and functionally the tuple-unpacking that some languages allow do come close to being equivalent to being able to return multiple values.

handle, errcode = open('blah.dat')

This is prettier than the all-too-common functions that do things like "this function will return the count of Widgets, or -1 if something went wrong", also it's less error-prone because with the above you can't accidentally treat an error_code as valid data. (and proceed as if there where really -1 Widgets, say)


(Log in to post comments)

No thanks.

Posted Nov 9, 2012 22:25 UTC (Fri) by HelloWorld (guest, #56129) [Link]

I didn't say that tuples were useless for error handling (although sum types (aka algebraic data types) are much more useful for that), I said that they don't help solving the "result = f(g(x))" problem.

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds