Re: Re: Re:class proposal 2
Serge Orlov <[email protected]>
| Newsgroups | gmane.comp.lang.prothon.user |
|---|---|
| Message-ID | <[email protected]> |
Mark Hahn wrote: > Lucius, Michael wrote: >>> ... It's prototype list will point to other classes >>> giving the normal class inheritance heirarchy. >> >> I assume you mean the class object will have the same protoypes as the >> instance object. > No the instance object would have only one prototype, which is the class > object. Then the class object would have the references to the other > classes. >> This means the class object will be an extension of the same >> prototypes as the instance object and so the class instance will not >> have access to the instance's methods/data. Or is 'self' going to be >> set to be the instance? > Self will always refer to the actual instance object. >>> ... Access to class methods inside a >>> normal method or inside a class definition would be through the >>> normal "Klass.class.method()" or through new syntax sugar that makes >>> use of the class keyword as a prefix "class.method()". >> >> How about the other way around? Is there a special way for class >> methods to access 'normal' methods that are defined in the instance >> or is this not allowed? Or must class methods access other class >> methods in a special way? > Now you are getting into an area that is screwed up in my proposal. In > Python you can say Klass.method() to access an instance method but that > wouldn't work in my proposal, even though instance methods are attributes of > Klass. My weird lookup rule would screw that up. Klass::method can be used to retrieve instance methods. It will be equal to Klass.instance_.method if you insist on putting instance method directly into Klass name space then you will still the same problems as today: 1) instance vs class .call_() 2) weird behavior of .str_() 3) ability to use class as instance which some people don't want to have. -- Serge