Is classless worth consideration
has.temp2 at virgin.net
Fri Apr 30 22:43:07 CEST 2004
Peter Hansen <peter at engcorp.com> wrote in message news:<84Kdnfu3OoN4oA_dRVn-vg at powergate.ca>...
> Hung Jung Lu wrote:
> > I have also pointed out previously that
> > Python uses 5 devices where prototype-based needs only one: (a) class,
> > (b) instance, (c) module, (d) metaclass, (e) scope. If this is not
> > hideously baroque, then, Houston, we've got a problem. If you can
> > really think outside the box, you'd pitch in also: (f) aspect.
> Well, (c) module is merely a packaging technique, not anything
> to do specifically with OOP, so it shouldn't appear in a list
> of "what do you think makes Python's OO model hideously baroque".
Modules are an encapsulation mechanism, just like class instances, so
I'd say the large and obvious overlap counts as unnecessary
duplication of functionality that by rights ought to have been
factored out of the language design early on. So I think it's
reasonable to count them, especially seeing how proto-OO languages
have no problems eliminating them as a distinct type.
> As for class and instance, unless all other languages that
> have class and instance are also considered baroque, it
> hardly seems fair to separate them.
Classes and instances are the foundation upon which baroqueness is
subsequently built. Eliminating the former not only gets rid of
another unnecessary type, it also removes the need for a lot of the
shenannigans that its presence encourages.
> Scope doesn't quite seem to fit in this either, but not
> being a theoretician I'll just leave the discussion at
> this point and point out that for the purposes of a *large*
> majority of the people using Python, these issues do not
> arise and Python OO is very much a breath of fresh air
> compared to anything else they've used. Which still makes
> it hard for me to see a claim of "hideous baroqueness" as
> anything other than deliberately inflammatory, but wrong.
Oh, I dunno. Let's see now... aside from classes and instances, which
proto-OO has already established is one more type than you need, we
also have (off the top of my head and in no particular order): magic
methods, magic hidden slots, funny privacy, __init__, descriptors,
self as argument, class methods (and variables), making calls to
superclasses, old-style/new-style classes, 'class' vs. 'type'
distinction, coercion, more magic methods (e.g. __slots__), super(),
the usual complaints about inheritance breaking encapsulation and
multiple inheritance gotchas, *anything* beginning with 'meta'... ech,
I could probably go on, but that ought to get you rolling.
You really should go check out Self, NewtonScript, etc. to broaden
your perspective of what OO is, and can be. Don't worry; the fresh
air'll do you good, and I'm sure Python will withstand my mean ol'
attacks upon its fine name in the meantime. :)
More information about the Python-list