3 ms·
> I wonder if this confusion of the pointee with the pointer is what makes this concept seem so difficult to those who didn't start with Asm Possibly (I starte
by bregma 6y ago
> I wonder if this confusion of the pointee with the pointer is what makes this concept seem so difficult to those who didn't start with Asm
Possibly (I started with asm, so I can't speak with certainty) but it could also be because many modern programmers first learned Java or JavaScript or Python in which most names are references to object (thus effectively all variables are addresses). Their first languages do not have value semantics, so grasping the concept of value semantics applied to a reference itself (ie pointers) is a major stretch.
- nicoburns 6y agoJavaScript does have value semantics for booleans and numbers. But it doesn't have any reference types which allow you to inspect the reference as a value.
- ptx 6y agoIn Python, everything is a pointer to a PyObject and always passed by value, so thinking of them as values makes sense. You can even easily get the address of the pointer by calling id on it (but not as easily convert it back).
- gpderetta 6y agodoesn't id return the address of the pointee?
- ptx 6y agoAh, yes - the value of the pointer, which is an address, the address of the pointee. (Even after reading that other thread, I messed up my terminology.) Actually, id returns a pointer to a PyObject representing an integer, the value of which is the value of the pointer that was passed as an argument, which is the address of the pointee. Right?