
Ask HN: Confused by a friend in discussion of variables - IAskForAFriend
A friend of mine is not a programmer, but does program.  My friend has a degree in mathematics, works in the supply of a specific type of computer hardware, uses Perl to accomplish various scripting tasks, and is very capable in doing so.<p>In discussion about programming languages I mentioned that &quot;variables&quot; are boxes to put things in, and the thing we put in them are &quot;values&quot;.  &quot;Values&quot; can be complicated, and may actually be references to other things.<p>My friend went thoughtful, and then said:<p><i>Suppose I have a hash:</i><p><pre><code>    $next{&quot;thingy&quot;}=&quot;whatname&quot;;
    $next{&quot;whatname&quot;}=&quot;wotsit&quot;;
    $next{&quot;wotsit&quot;}=&quot;doohickey&quot;;
</code></pre>
<i>Then I would have said</i> (my friend said) <i>that:</i><p><pre><code>    $next{$next{$next{&quot;thingy&quot;}}}
</code></pre>
<i>is another name for &quot;doohickey&quot; and hence is a variable.</i><p>Is this a common point of view?
======
db48x
Kinda. Sometimes these are called "lvalues" (because they go on the left-hand
side of an assignment statement), or perhaps "places", or some similar name.
It depends on the language, and what languages the designer was
influenced/inspired by when they were doing the design work. That leaves
"variable" to just refer to the simplest case.

Oh, and just for the record, your friend _is_ a programmer. Maybe it's
secondary to the mathematics, but nobody is ever just one thing.

~~~
IAskForAFriend
Thank you for the reply - interesting.

Just to clarify, saying that my friend is not a programmer was meant to set
expectations, not to be disparaging. My friend write short scripts to
accomplish specific tasks, but is not employed to write programs, has never
studied programming or computer science, has never written a program longer
than about 50 to 100 lines, has never written a program for someone else to
use, and actively refuses to be called a programmer.

Neither of us consider that a problem or criticism, but simply a statement of
fact. I play music, but I'm not a musician. I sing, but I'm not a singer. I
dance, but I'm not a dancer. I write stuff, but I'm not a writer. I program,
but I'm not a programmer. I do math, and use math, but I'm not a
mathematician. On occasion I run, but I'm not a runner. Yes the exact
boundaries are fuzzy, it's difficult to create clear and precise definitions,
but to describe someone who cooks the occasional dinner "a chef", or even "a
cook", is to lose distinctions I think are worth retaining, and to dilute the
terms to the point of being effectively worthless.

Oh, and my friend doesn't use the mathematics particularly either, and refuses
now to be called a mathematician.

But it's unlikely we'll reach agreement on this, so I just thought I'd make my
position clear.

------
RiderOfGiraffes
What you have there is an l-value, which is an expression that evaluates to a
location into which a value can be placed.

A variable is a single name and is the simplest example of an expression that
is an l-value.

