You know, if you could just call null.toString() and have it return "null" instead of throwing an exception, in exactly the way it behaves when you call "some string "+null, I would hate Java so much less...
Where do you go from there? Should null support the entire API for Object? What if I want to override the default NullObject's to.String() behavior? Can I set null = myObject? Madness!
Well, if we got rid of primitives entirely, null would be an Object just like everything else.
It wouldn't be extensible, so you couldn't inherit/override, and of course you can overwrite any reference to null, but it's probably a lot easier to just look at smalltalk and objective-c to figure out what the right answers to such questions are.
[sarcasm font|Scott voice enabled] Java's *perfect*? Why would you use *any* other language? Are you mad? And, nobody uses Perl, that's the silliest language *ever.*[/sarcasm/Scott]
There is, of course, the school of thought which says you should create static NULL objects for your classes and use those. Then you can wrap String in a class with your own convenience methods.
no subject
Date: 2004-12-07 02:24 pm (UTC)no subject
Date: 2004-12-07 02:59 pm (UTC)(Currently wrestling with javax.swing.undo.*)
no subject
Date: 2004-12-07 03:19 pm (UTC)no subject
Date: 2004-12-07 03:02 pm (UTC)no subject
Date: 2004-12-07 03:15 pm (UTC)It wouldn't be extensible, so you couldn't inherit/override, and of course you can overwrite any reference to null, but it's probably a lot easier to just look at smalltalk and objective-c to figure out what the right answers to such questions are.
But, it's the *best*
Date: 2004-12-07 03:29 pm (UTC)Sorry. Had a flashback...
k8
no subject
Date: 2004-12-07 03:42 pm (UTC)no subject
Date: 2004-12-07 09:59 pm (UTC)no subject
Date: 2004-12-07 10:20 pm (UTC)