Re: Object Class and Data Type

From: Laconic2 <>
Date: Wed, 31 Mar 2004 07:45:04 -0500
Message-ID: <>

Given what you said below,  it almost seems as though every finite type is a class.  If the type "integer" has an infinite number of values,  maybe not.  But if the type "integer" includes only values from
-maxint to maxint (where maxint is some appropriately defined limit)  it seems to me that there is an invariant,  and a fairly important one. 
For one common value of maxint  the invariant is: you can store it in four bytes.
"Tom Hester" <$$> wrote in message news:a8b99$406a148a$45033832$
No they are not the same.  Perhaps understanding the difference should be a prerequisite to contributing to a theory group.  "[A type system is a] tractable syntactic method for proving the absence of certain program behaviors by classifying phrases according to the kinds of values they compute."
(Types and Programming Languages, MIT Press, 2002)  "A class contains a description of  data ("state") stored in the objects of the class.  A class implements its interfaces by specifying methods that describe what operations can be performed on the data stored in the objects of the class.  A class also describes a set of invariants that are preserved by every method in the class. An invariant is a constraint on the state of an object that should be satisfied by every object of the class. The main purpose of the invariants is to establish what objects belong to the class. An invariant is what distinguishes datatypes and classes from each other. " 
As I said before, the purpose of a type is to highlight differences (absences of behavior)  whereas a class hierarchy is intended to highlight similarities (invariants).
Received on Wed Mar 31 2004 - 14:45:04 CEST

Original text of this message