3 ms·
I think the trick is that any programming language that lets me operate on bytes (and hence makes me care about things like memory addressing) shouldn't prevent
by angersock 13y ago
I think the trick is that any programming language that lets me operate on bytes (and hence makes me care about things like memory addressing) shouldn't prevent me from having nulls.
A NULL (usually defined as 0) is a valid memory location, especially if you are doing certain types of systems work--the fact that we've used it as a sentinel value in C/C++ is a separate problem entirely.
Maybe we need to use a taxonomy where languages that do not express anything about layout in memory (as bytes, quibits, or whatever) are kept separate from other languages.
The issue, of course, is that eventually you need to move out from algorithm space and start dealing with real hardware, which speaks bytes. Then again, a model where you only interface over JSON blobs might obviate the need for that, provided you don't talk to anything that speaks in something other than numbers and human-readable strings.
- pcwalton 13y agoWhether you have null pointers in the language is orthogonal from having control over memory layout. You can have nullable pointers at the machine level without introducing them into the type system. (The typical way to do that is Maybe/Option types.) What the author is talking about is the idea that a pointer dereference operation will never result in a failure (exception, segfault, panic, etc). That's a separate concern from control over memory layout.
- gizmo686 13y agoI think you are talking about a separate (and identical issue). "NULL" is not a valid memory location. 0 is a valid memory location. Because we have to express NULL as the same primitive type as valid memory locations, we have no way to distinguish between NULL and 0. In a language with a type system that prevents you from dereferencing NULL, this problem goes away. Now that the type system can distinguish between NULL and a pointer, we can once again use 0 as a valid pointer.
- JadeNB 13y ago> I think you are talking about a separate (and identical issue). Somehow, this reads very strangely to me. Are you saying something like "I think you are talking about the same issue from a different point of view"?