What is a type error?

Joachim Durchholz jo at durchholz.org
Thu Jul 13 13:22:15 EDT 2006


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).


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.

 > I agree that mutability
> plus identity implies aliasing problems, however.

Then we're agreeing about the most important point anyway.

>> 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?

Regards,
Jo



More information about the Python-list mailing list