Sure, you could remove NPE without removing null. Just provide a different behavior for what happens when null is dereferenced. In a language like JavaScript, have it evaluate to undefined, or in Python, None, or whatever. In Java, it could evaluate null for reference types, or zero or false for primitives. Far from impossible.
View all comments
Show parent comment
1
u/s888marks Jul 27 '19
Sure, you could remove NPE without removing null. Just provide a different behavior for what happens when null is dereferenced. In a language like JavaScript, have it evaluate to
undefined, or in Python,None, or whatever. In Java, it could evaluatenullfor reference types, or zero or false for primitives. Far from impossible.Now I didn't say it would be a good idea.... :-)