[Types-sig] Re: Meta-classes discussion starter

Gordon McMillan gmcm@hypernet.com
Mon, 30 Nov 1998 16:34:16 -0500


Evan Simpson, after re-reading Guido's ASCII art post, writes:

> I can see how defining them, and specifiying their meta-classes,
> would solve the binding and naming problems.  You could even have
> multiple meta-classes just as you have multiple inheritance.  All
> you need now is a way to spell static methods.
> 
> Thanks for helping me work that out.

Don't you just hate stretching your brain to the limits, and then 
finding out the Guido has zipped right past you?

Much as I hate to admit it, I think Guido's ideas solve a number of 
problems with thinking about metaclasses, and opens the door to "Meta 
Object Protocol" type behavior, which is, I think, what we're really 
after.

One possibe spelling of this (which I don't have much hope for, but 
at least it's better than David's <wink>):

class MyClass(bases=(MyBase,), turtles=(Trace,)):
  blah...

Now my "what"s come from MyClass and MyBase, but my "how"s come from 
Trace. Voila, (relatively) painless __getattr__ / __setattr__ hooks 
(courtesy of turtles).

Now I can see where SmallTalk-ish "class methods" fit (in turtles), 
but not where (or if) those silly "static" type class methods fit. 
Not that I have much attachment to them, but they seem to be a 
commonly desired feature.

Best of all, you don't have to use that damn m-word, or wonder how an 
object can be both an instance and a class at the same time.

ride-a-turtle-and-take-the-strain-off-your-brain-ly y'rs

- Gordon