What is a type error?

Marshall marshall.spight at gmail.com
Thu Jul 13 15:47:57 EDT 2006


Joachim Durchholz wrote:
> Marshall schrieb:
> > Mutability by itself does not imply identity.
>
> Well, the implication certainly holds from identity to mutability.
> The only definition of identity that I found to hold up for all kinds of
> references (pointers, shared-memory identifiers, URLs etc.) is this:
>
> Two pieces of data are identical if and only if:
> a) they are equal
> b) they stay equal after applying an arbitrary operation to one of them.
>
> This means that for immutable objects, there's no observable difference
> between equality and identity (which I think it just fine).

Agreed on all counts.


> For the implicaton from mutability to identity, I'm not sure whether
> talking about mutation still makes sense without some kind of identity.
> For example, you need to establish that the object after the mutation is
> still "the same" in some sense, and this "the same" concept is exactly
> identity.

Unless we have some specific mechanism to make two named variables
have the same identity, (distinct from having the same value), then
there
is no aliasing. Pointers or references is one such mechanism; lexical
closures over variables is another. (I don't know of any others.)


>  > I agree that mutability
> > plus identity implies aliasing problems, however.
>
> Then we're agreeing about the most important point anyway.

Yes.


> >> In other words, pointers are essentially just an *aspect* of mutability
> >> in lower-level languages.
> >
> > Again, I disagree: it is posible to have mutability without
> > pointers/identity/objects.
> 
> I'm sceptical.
> Any examples?

See next post.


Marshall




More information about the Python-list mailing list