The Philosophy of Nothing
Paul Benedict
pbenedict at apache.org
Tue Dec 1 14:30:45 PST 2009
Neal,
> Given that null is not a valid value for Nothing, and triggering the
> "problem" requires working under the covers, I don't see much value in
> adding to the platform another exception type. I did have to diagnose this
> kind of problem while writing the closures implementation, and I found it
> easy with the null pointer exception. I'd be interested to hear any
> experience to the contrary.
This was an interesting response.
Up until now, I believed that a "void" method leaves the return value
undefined. I know that in the x86 architecture, EAX is commonly used
as the return value, and that the register is simply ignored for
"void" methods.
Because you said that an NPE would be generated, does that mean the
JVM explicitly sets the return value of a "void" method to null? I can
believe it. When I use reflection, "null" is the return value of a
"void" method.
Paul
More information about the closures-dev
mailing list