thoughts on the typesystem
27 Apr 1999 07:17:42 +0200
>>>>> "Tom" == Tom Novelli <firstname.lastname@example.org> writes:
Tom> Personally, the idea of a type/class system is pretty alien to
Tom> me. My world consists of only 'objects'. Some 'objects' are
Tom> very concrete: pen, pencil, keyboard, phone... Others are more
Tom> vague (abstract): writing implement, thing, idea, Tunes :),
Tom> letter, song... All these 'objects' relate to one another in
Tom> different ways. Who needs types when we have _relations_? We
Tom> can say "a pencil _is_ a writing implement" or "a pen _is like_
Tom> a pencil" or "2 _is not_ a letter". As far as I know, that's
Tom> how I represent things in my head, and that's how other people
Tom> do it too. Does anyone here do it differently?
I think that we type objects when we use them. You should probably
read articles by Liskov which try to understand inheritance in a
behavioural manner (I don't have pointers here, sorry). When you use a
bed to sleep, one could say that you are using it's bed interface. But
when you are just sitting on it, you are using it's seat interface. So
it all depends on the context, ie "on the run time use".
I've had a thought about a data model based entirely on relations
between constant objects. Object would have no field or properties,
just an identity that cannot change. A relation between several
objects is on fact embodied by an object that links those objects
Link_A_B <------ Marriage
A <---+ +--> B
Links would be belong to a relation object, and when you want to
know which object is associated with A for a given relation, you would
ask the relation object. In my exemple, if you want to know who is A
married with, you ask `Marriage.GetAssociatedObjects(A)', and it would
return B. Instead of having a name property in A, it would be linked
to a string object by a Name relation.
If we give a value in [0,1] to links, it would allow fuzzy queries.