I'm wrong or Will we fix the ducks limp?

Random832 random832 at fastmail.com
Mon Jun 6 17:13:01 EDT 2016


On Mon, Jun 6, 2016, at 14:59, Steven D'Aprano wrote:
> "Variables as boxes" is a long-standing, well-known metaphor for the C
> and
> Pascal variable model, one where the value is copied into the box
> (metaphorically), or to be more precise, where variables have fixed
> locations and on assignment values are copied to that location.

I don't think that's "to be more precise" at all. I think that is an
entirely different model.

The box metaphor as I understand it involves a lot of boxes, which may
contain arrows (call them pointers, references, or whatever) emerging
from them pointing to other boxes, which are all free-floating with no
implication that any of them are fixed locations or are not dynamically
allocated.

The most classic use of it, after all, is for Lisp, in which two boxes
glued together represent a cons cell, something absolutely nobody would
accuse of having a fixed location. Google "lisp box diagram"  for any
number of examples.

What does a diagram of *your* "variables as boxes" model look like?

> The broader programming community

Between this and the argument about "constructor" terminology, clearly
you and I see "the broader programming community" very differently.

> understands "variables as boxes" to mean fixed size boxes in fixed
> locations with assignment-as-copying, as used by C and Pascal. I don't
> think it is helpful for you to invent your own metaphor of Python-
> style variables being boxes.

> > (if you prefer Marko's analogy, "Some puppies hold leashes in 
> > their mouths").
> 
> I don't know what Marko's analogy is. Puppies with leashes? What?

It was a couple days ago in this thread, in a reply to a post by you.

On Sun, Jun 5, 2016, at 04:01, Marko Rauhamaa wrote:
M> You could also think of variables as pegs, references as leashes, and
M> objects as cute puppies. One puppy could be held with multiple
leashes
M> hung on separate pegs. Some puppies hold leashes in their mouths.
Every
M> leash is tied to a puppy or a special wooden post called None.

(I disagreed with him on "None" needing to be a special wooden post for
the analogy to work)

R> > Attributes and list items and dictionary keys and values 
R> > are also boxes.
S> 
S> They're not boxes in the sense of the "variables are boxes" model.

I would say 'yes they are', but clearly *your* "broader programming
community's" version of the ""variables are boxes" model" is different
from everyone else's. I don't think continuing this discussion is likely
to be productive.



More information about the Python-list mailing list