[Types-sig] Re: Meta-classes discussion starter
Tim Peters
tim_one@email.msn.com
Tue, 1 Dec 1998 05:10:58 -0500
[John Skaller, deconstructs classes and finds ... no, I won't
spoil the surprise <wink>]
> ...
> And that is it. :-) There is no such thing as a class :-))
> It is nothing more than a function which makes objects.
> ...
John, Python is not a functional language, and there's not a shadow of a
hint that it will ever become one.
I would welcome a few more carefully chosen functional features myself, but
"everything's a function" is so obviously not in Python's worldview that
this crusade has about as much chance of success as a "and how do we express
functions? with a character set, of course! so only strings are of any
consequence, and what is required for meta-programming is richer builtin
string synthesis facilities" rant. At least try to sell it as "everything's
a callable object!" so a few may be tricked into thinking it's Python <0.9
wink>.
> ..
> If we had these kinds of constructions in python, we could build
> functions which generate functions more easily than we can today
> [using exec, or by emulating these things with classes]. And then
> we would have a better meta-programming system.
What we would have is another functional language, a niche already fatally
over-served by others. They're elegant! Succinct! Powerful! Gorgeous!
Virtually unused! Most people find them hostile and austere. The repeated
failure of functional languages to catch on over 25+ glorious years is hard
to wish away. You would like them, though! I sure did (but I don't often
confuse them with Python, and when I do Guido ignores me until I snap out of
it ...).
> ...
> I'm not against 'encapsulating' these meta-functions
> in 'meta-classes', I'm just pointing out that classes aren't
> fundamental, at least in Python.
I agree that they're not, today, but even less so are functions today; part
of the thrust of "healing the type/class split" appears to be to *make*
classes fundamental to the language, though. Good move. People like
classes, every anthropomorphous little bit of 'em (children! parents!
birth! death! history, memory, "jobs" their instances are even "contracted"
to do! it's so *cute* -- helpful, too).
> Or, you can turn that around, and consider functions
> as a special kind of object:
That's been Python's worldview from the start.
> and my very point is that we need primitives to operate on this
> kind of object and we don't have them.
How about a specific proposal? You've made the high-concept "series and
parallel and switch" pitch before, but until there's some meat on its bones
it will most likely get tossed to the dogs <woof>.
gimmicks-are-an-easier-sell-than-philosophies-which-is-why-you-
never-see-ronco's-amazing-new-ontological-clarifier-on-wee-
hour-american-tv-ly y'rs - tim