anything like C++ references?
Adam Ruth
owski at hotmail.com
Mon Jul 14 19:38:56 EDT 2003
In <sdd6hvsmsq32o62oknpqft6dc61lbup8rn at 4ax.com> Stephen Horne wrote:
> On 14 Jul 2003 10:30:22 -0400, aahz at pythoncraft.com (Aahz) wrote:
>
>>In article <7dc4hvslh7a8fk9p6cvsfqa1c8d44rmmnv at 4ax.com>,
>>Stephen Horne <intentionally at blank.co.uk> wrote:
>>>
>>>C++ has precisely one type of variable. That variable is a
>>>placeholder for a value of a datatype which is specified in the
>>>declaration. The datatype may be a pointer datatype, but so what?
>>>Pointer datatypes are not treated any differently than other datatype
>>>except that they, like all datatypes, they have their own set of
>>>functionality.
>>
>>Really? I would argue that the differing syntaxes is an argument
>>against a single type of variable. What happens with this:
>>
>>char a;
>>a->b;
>
> To answer this, I simply have to restore the quote you deleted...
>
>: On 13 Jul 2003 21:03:59 -0700, owski at hotmail.com (Adam Ruth) wrote:
>:
>: >I don't see the arbitrary change. Python has one type of variable:
>: >A pointer that cannot itself be dereferenced. It's much more
>: >consistent then having 3 types of variables (in C++).
>
> This is not referring to data types - there are far more than three
> data types in C++. It is referring to whether something is a pointer
> or a reference or not. The mistake in Adams post simply being that
> these are simply datatypes.
>
> You will note that even in my words, I tried to keep the distinction
> clear by using the word 'datatypes' when I was referring to datatypes.
>
> In fact, lets look back at my first two scentences in your quote of my
> reply.
>
>>>C++ has precisely one type of variable. That variable is a
>>>placeholder for a value of a datatype which is specified in the
>>>declaration.
>
> One *type* of variable, which is associated with its own *datatype*.
>
> I find it hard to see how you could confuse this, but given my own
> mistakes - well, we're all human I suppose.
So, then, what makes a different variable type? If not different syntax
and semantics, what would be the signature?
Let me see if I understand what you're saying. Even though C++
variables can have different syntax and semantics (depending sometimes
on context), the're all really the same internally and are therefore
perfectly consistent and usable. Python variables, on the other hand (
mutable and immutable) have somewhat different semantics (a debatable
point) but identical implementaions (indeed, indistinguishable), but are
somehow invalid?
You say that there is one gold standard definition for what a variable
is. Yet even though C++ deals with variables in three semantically
distinct way, they are somehow all valid within that definition?
Adam Ruth
More information about the Python-list
mailing list