What is a type error?

Chris Smith cdsmith at twu.net
Thu Jul 13 13:27:31 EDT 2006


Marshall <marshall.spight at gmail.com> wrote:
> Hmmm, well, I cannot agree. You've defined away the pointers
> but then slipped them back in again by assumption ("objects
> of these types have identity".)
> 
> First let me say that the terminology is somewhat problematic.
> For the specific issue being discussed here, pointers, identity,
> and objects are all the same concept. (I agree that "pointer"
> connotes a low-level construct, however.)

Unless I'm missing your point, I disagree with your disagreement.  
Mutability only makes sense because of object identity (in the generic 
sense; no OO going on here).  Without object identities, mutability is 
useless.  What's the use of changing something if you're not sure you'll 
ever be able to find it again?

You may limit the scope of object identity arbitrarily, even to the 
point that aliasing is impossible (though with lexical closure, that 
gets even more limiting than it may first appear)... but you're just 
trading off power for simplicity, and the really interesting uses of 
mutations are those that allow access to specific objects from any 
number different bits of code, on a program-wide or at least module-wide 
scope.  Most mediocre programmers could replace assignment with 
recursion if that assignment is limited to local variables of a single 
subroutine.  I don't necessarily agree that the result will be a better 
program despite others' conviction on the matter; however, the 
difference certainly isn't worth complicating the language with mutation 
unless you're willing to allow the interesting uses of mutation as well.

> Mutability by itself does not imply identity. I agree that mutability
> plus identity implies aliasing problems, however.

We might have a terminological issue, then.  I'd tend to say that 
mutability definitely does imply identity, but identity doesn't imply 
aliasing.  Same difference.

-- 
Chris Smith - Lead Software Developer / Technical Trainer
MindIQ Corporation



More information about the Python-list mailing list