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

John Skaller skaller@maxtal.com.au
Wed, 02 Dec 1998 18:17:55 +1000


At 05:10 1/12/98 -0500, Tim Peters wrote:
>[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.

        You're not following. I'm analysing the _structure_ of a system.
I'm telling you classes are _isomorphic_ to functions; and providing
the isomorphism. I didn't claim 'python was a functional language'.

>I would welcome a few more carefully chosen functional features myself, but
>"everything's a function" is so obviously not in Python's worldview 

        Excuse me. Python is a piece of software. It doesn't have a worldview.
Perhaps _you_ do. If it isn't in your worldview, fine.

>that
>this crusade has about as much chance of success as a "and how do we express
>functions? 

        This is not a 'crusade'. It's an analysis.

>> 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 ...).

        Now who is ranting? <g>

        My suggestion is for more builtin functions, of the kind needed
to construct functions.

>>         Or, you can turn that around, and consider functions
>> as a special kind of object:
>
>That's been Python's worldview from the start.

        Sigh. If functions and objects are consider _dual_,
then it's clear you need a balanced set of features to support
both functions and objects.

        Python has reasonable support for objects. It could do with
more support for functions. Or would it be more 'appealing' if I called
them methods?

>> 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>.

        There is some code available for browsing.
-------------------------------------------------------
John Skaller    email: skaller@maxtal.com.au
		http://www.maxtal.com.au/~skaller
		phone: 61-2-96600850
		snail: 10/1 Toxteth Rd, Glebe NSW 2037, Australia