Re:Examining ARM vs. x86 Memory Models with Rust
by bregma on Saturday June 27, 2020 @07:48AM
(#23661202)
> 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.
Re:Examining ARM vs. x86 Memory Models with Rust
by ptx on Saturday June 27, 2020 @12:57PM
(#23662954)
In 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).
Re:Examining ARM vs. x86 Memory Models with Rust
by gpderetta on Saturday June 27, 2020 @08:38PM
(#23665876)
doesn't id return the address of the pointee?
Re:Examining ARM vs. x86 Memory Models with Rust
by ptx on Sunday June 28, 2020 @04:10AM
(#23667403)
Ah, 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?
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 (especially multiple indirections) --- I certainly saw a lot of that when I used to teach CS courses.