Is classless worth consideration
newsgroups at jhrothjr.com
Thu Apr 29 04:48:12 CEST 2004
"David MacQuigg" <dmq at gain.com> wrote in message
news:g9k090lhocd1nbd7g230br6ooub113hjt6 at 4ax.com...
> On 27 Apr 2004 16:34:56 -0700, has.temp2 at virgin.net (has) wrote:
> >David MacQuigg <dmq at gain.com> wrote in message
news:<bniq80hiib0gauiltuntk9jvia2getbnj4 at 4ax.com>...
> >> Example of Simplified Classes ( Prototypes )
> >> ============================================
> >Class-based OOP by any other name. But then, I've pointed this out
> >already. See Emperor, clothes; lack of.
> >Here; while I don't claim them to be paragons of programming, I
> >suggest taking a look at my old AppleScript libraries at
> ><http://applemods.sourceforge.net/>. (Note: scripts are compiled, so
> >you'll need a Mac to view source.) See Types, HTMLTemplate and ASTest
> >for examples of OO programming that isn't class-fixated. Might lend
> >some useful perspective.
> The problem we Python programmers are having is understanding the
> fundamental advantage of eliminating classes and working only with
> instances. The theoretical discussions put me to sleep. I can't see
> the point of the examples above. What we need is a simple use case.
> I've included the ability to clone one instance from another in my
> "Python 3" proposal
> This will allow the user to completely ignore classes, and just make
> one instance from another, then another, and so on, modifying each
> instance along the way, whenever the urge is felt.
> Here is what I have so far in the Pros and Cons on this feature:
> Pro: Allows "on-the-fly" programming style with no classes.
> Con: Can lead to more undisciplined programming.
> Perhaps you can help us here.
So far, I have one use case: text adventure game programming.
Most of the objects in such games are one-off, and having to
create a class and an instance for each piece of scenery is more
than a bit much. This is one of the reasons that standard programming
languages have never gotten much traction in that domain.
It's just occured to me that backing into that particular
issue might work: use class methods and never bother
with instantiating the classes at all. I'm not sure what
we'd lose. (possibly descriptors?)
> -- Dave
More information about the Python-list