Print

Print


On Wed, 25 Mar 2009, Andrew Cooper wrote:

> I'll confess I'm not precisely sure how you mean "mix things together", so I'll
> just go through the options that occur to me:

This discussion started from the observation that if you have a
sufficiently general concept of 'map' in your language you don't really
need classes. That is, classes (or at least class instances) can be
encoded as maps. This allows one to treat all class instances in a uniform
way. For example one could iterate over the fields of an object without
knowing (or caring about) the object's actual type.

My question is: does one really want that? If I create a class
'CharacterBuffer' and another class 'Timer' do I really want to be able to
treat them uniformly? It seems to me that I actually want them to be
different. That is, I don't want to accidentally try to process a Timer as
if it was a CharacterBuffer. I created two separate classes intentionally
because I am dealing with two separate concepts.

Of course object oriented languages that derive all classes from 'Object'
or something similar already do try to treat all objects uniformly to a
certain degree. But then I don't really like that either. :-)

Peter