Andreas Rossberg schrieb: > Joachim Durchholz wrote: >>> >>>> It's worth noting, too, that (in some sense) the type of an object >>>> can change over time[*]. >>> >>> No. Since a type expresses invariants, this is precisely what may >>> *not* happen. >> >> No. A type is a set of allowable values, allowable operations, and >> constraints on the operations (which are often called "invariants" but >> they are invariant only as long as the type is invariant). > > The purpose of a type system is to derive properties that are known to > hold in advance.
That's just one of many possible purposes (a noble one, and the most preeminent one in FPLs I'll agree any day, but it's still *not the definition of a type*). > A type is the encoding of these properties. A type > varying over time is an inherent contradiction (or another abuse of the > term "type"). No. It's just a matter of definition, essentially. E.g. in Smalltalk and Lisp, it does make sense to talk of the "type" of a name or a value, even if that type may change over time. I regard it as a highly dubious practice to have things change their types over their lifetime, but if there are enough other constraints, type constancy may indeed have to take a back seat. Regards, Jo -- http://mail.python.org/mailman/listinfo/python-list