www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Re: Pluggable type sytems

 In fact, I'd even argue that non-nullability should be the default for 
 pointers and class references

Not against it for class references, but utterly against it for pointers as that is one of main points of using a pointer to me. Using structs, classes, primitive variables, and arrays I would agree the majority of the time do not need null checks as we do not want nulls, however non-nullability of such things can lead to confusion as default values of these (especially classes) does not always have a well defined expectation. We could add something to the compiler to check if it is initialized but what if we do get a null reference for some reason (calling convention to heterogeneous code). If i want a reference to a class and get a pointer from a library as such i would end up getting the pointer and checking for null before making it non-nullable by a cast both of which also take time.
Jan 20 2009