Re: class proposal 2

Serge Orlov <[email protected]>
Newsgroups gmane.comp.lang.prothon.user
Message-ID <[email protected]>
Greg Ewing wrote:
> Mark Hahn <[email protected]>:

>> I've got a two-tier class proposal that is more concrete than my old one.
>> It is mostly based on Serge's proposal but I feel Paul's thinking is
>> incorporated.  As always feel free to shoot holes in it.

> This looks interesting, but something doesn't seem quite right about
> it. If class methods are to be methods of the class in the same way
> that instance methods are methods of the instance, they should be kept
> in the instance-method-area of the class's class, not in the class.

> Classes in this proposal don't seem to have classes. In other words,
> they're not themselves objects within their own paradigm.  In this
> respect, they're more like old-style Python classes.  To a Python
> person, this will seem like a backward step.

The missing link is type. I've been pitching "right" types
since I realized how types in 1-tier system should work,
http://www.prothon.org/pipermail/prothon-user/2004-June/001805.html
later I realized the same applies to 2-tier systems.

Every class should have Type type:

class Type:
    class:
        type_ = Type
    ....

class X:
    class:
        type_ = Type
    instance:
        type = X

Besides all new class proposals break except statement, if
you try to write

except X:

it won't work because except is walking prototype chain and
the chain will lead you to X.instance_ prototype which is
not equal to X. Types solve that.

  -- Serge
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.