On Wed, Jul 1, 2009 at 11:20, Ben Schulz<[email protected]> wrote: >> The problem with Java's null is the instance of bottom in the static >> type system, but outside the dynamic type system. Classic puzzler: >> >> public boolean puzzle(String par) { >> return (par instanceof String); >> >> } >> >> How to get a false? Pass a null. The type systems don't match. > > Yes, this really should return true for null, however since (right > now, in Java) null is allowed everywhere, I don't mind so much.
No, it shouldn't return true for null. You're confusing *instanceof* with some hypothetical iscompatiblewithtype. Null is not an *instance* of anything. There's *nothing* there. It's null. Sorry, but the sloppy way null is used in typical Java code is one of my pet peeves. // Ben /* oh no, name clash ;-) */ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "The Java Posse" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/javaposse?hl=en -~----------~----~----~----~------~----~------~--~---
