|
Denis wrote: On Wed, May 26, 2010 at 11:09 PM, Walter Bright <[email protected]> wrote: It's true that if the language got rid of null pointers, there wouldn't be null pointer exceptions. The problem is this doesn't solve the problem, it just shifts it elsewhere. I normally use null pointers for data that shouldn't be there, like for example, to mark the end of a list. If I didn't have null pointers, I'd have to write a special "end of list" object. What should that object do if accessed? Throw an exception. And so I'm right in exactly the same place I was with the null pointer, except that I had to write a bunch of extra code to get there. Null pointer exceptions are not bugs. They are bug detectors. Defining null pointers out of a language is like putting black electrical tape over the oil pressure light on your car. Voila! No more pesky lights annoying you! |
_______________________________________________ phobos mailing list [email protected] http://lists.puremagic.com/mailman/listinfo/phobos
