On Saturday, April 25, 2020, 04:17:14 PM EDT, Michael Kjörling
<michael(a)kjorling.se> wrote:
I was thinking: couldn't we apply the same kind
of reasoning to
variables as well?
...
In short, yes. In the language Bliss, all identifiers
stood for the address of that thing. A prefix dot (.)
dereferences that thing. So copying x to y would be
something like
y = .x;
In C, rvalues have an implicit dereference happening.
I've actually created a toy language that I subject
my students to that revives the Bliss view to drive
home in their minds the difference between the
address of a memory location and the contents
of a memory location. I want them to have some
concept of how the program connects to the machine
before they find themselves so mired in abstraction
that everything is treated as magic.
One of my TAs in that class last fall was taking a
class in the winter where she was using C seriously
for the first time and having trouble understanding
pointers. When I explained how C pointers worked
in terms of the variables and dots of this other
language it became much more clear for her.
BLS