I'm wrong or Will we fix the ducks limp?
random832 at fastmail.com
Tue Jun 7 11:14:30 EDT 2016
On Tue, Jun 7, 2016, at 03:03, Gregory Ewing wrote:
> a = 42
> b = 17
> c = &a
> c = &b
> does 'c' now hold a reference to the variable 'b', or
> does it still hold a reference to 'a' and 'a' now
> holds a reference to 'b'?
It'd have to be spelled *c = &b, or c.value = &b or c.setvalue(&b), or
something like that, to mean the latter.
> Somehow these two operations would have to be spelled
> different ways, which means you would need to know
> whether you were dealing with a variable reference or
> not. So they wouldn't really be first-class, in the
> sense of being treated on an equal footing with
> ordinary variables.
Er, how would that make them not first class? Lots of operations need to
be spelled differently, that's why we have so many operators, attribute
lookup syntax, etc. "Assign to the variable object that is in this
variable" would be a distinct operation from "Assign to this variable",
just like "add one to this value" or "call this function" etc.
More information about the Python-list