Re: Re: Re: class proposal
Lenard Lindstrom <[email protected]>
| Newsgroups | gmane.comp.lang.prothon.user |
|---|---|
| Message-ID | <Mahogany-0.66.0-4294685659-20040623-120815.00@pop3.norton.antivirus> |
On Tue, 22 Jun 2004 16:32:43 -0700 Mark Hahn <[email protected]> wrote: > Lenard Lindstrom wrote: > > >> What are wild-card properties? If I don't know about them, how were > >> they going to be implemented :-) > >> > > These were discussed as an alternative to Python's __getattribute__, > > __setattr__, __delattr__. > > > > http://www.prothon.org/pipermail/prothon-user/2004-May/001560.html > > > > Apparently __getattribute__ has been confused with getattr(). > > > > [Prothon-user] Re: Extremely lightweight properties? (RE: > > prothonsuggestion) > > http://www.prothon.org/pipermail/prothon-user/2004-May/001567.html > > I remember now. Somehow that got lost and never made it to the to-do list. > It is on it now. > > > So where the prothon interpreter has to deal with multiple > > inheritance and dictionary lookups, the python interpreter only > > supports single inheritance > > and one-tier types. So which is the more complicated language? > > So python has moved the complications up into the Objects. That doesn't > seem very efficient. It's as if they built a complex language on top of a > simple one. > > The optimization I am planning of caching the prototype chain lookups needs > to be at the heart of the interpreter. I could never do that if it was > layered on top of some other interpreter. There are other similar issues. > > I may be wrong but implementing prototypes on top of another interpreter is > guaranteed to be a performance nightmare. I don't know about class > implementation but I would suspect that Python is suffering a similar > problem from their architecture. > > > Prototypes can easily be implemented using types. So can classes, as > > is the case with Python. To suggest that the prothon interpreter > > should distinguish between 'classes' and other objects is more > > object-oriented than Python. This is ironic for a language that is > > supposed to be class free. > > Prototypes can easily be implemented in visual basic also, but I don't think > I'd want to do that :-) > I have not been able to spend the time on the topic of classes that it deserves. I am certainly not against classes. And sleeping on the subject has let me see that the direct approach taken in Prothon may indeed give it a performance edge over Python. I also did not know about the optimization trick for an attributeless objects having a single prototype. That certainly provides an edge. But if you are going to have classes then you should make sure they are used to full advantage. I do not know how Prothon currently handles mro calculations. If it is doing it for every attribute lookup that is too expensive. Certainly it will be for C3. But classes let you calculate the mro once at class creation and keep it around as a list. Much faster. This is a big topic and I cannot devote the time needed. So to avoid confusing things by making suggestions when I only half understand what is going on I will sit this one out. Lenard Lindstrom <[email protected]>