I actually use asserts in my C code as well to cover the cases where I may receive a null pointer (ex. an argument passed to a function). I think we were talking past each other a little bit. I meant maybe you could change the ? operator's representation to be the exact same as the ^. To the compiler ^ and ? would be identical. It would be purely a mechanism to signal to a programmer that a pointer may be null.
After taking your post into consideration, the only benefit may be in clarifying return values to functions where you would have something like the following:
// Here the use of the ? instead of ^ signals that we may be returning a null pointer.
//If I store the result of the call in on the caller's stack I should make sure to check for a null/nil.
| search :: proc( /*args*/ ) -> ?Value_Type
|
vs.
//You would use the ^ here if you were for certain going to return a valid pointer and therefore wouldn't
//have to check the return value for the function.
| search :: proc( /*args/ ) -> ^Value_Type
|
The code above is just to clarify my previous point. I am not strongly pushing for the optional type.
I do agree with you though null pointer deref isn't typically a big time sink to fix at least that has been my experience. It may very well be different for more experienced developers working in a more complex code base.