A 'Python like' language

Glenn Andreas gandreas at no.reply
Mon Mar 29 10:16:29 EST 2004


In article <BSR9c.57832$cx5.56065 at fed1read04>,
 "Mark Hahn" <mark at prothon.org> wrote:

> > Not quite the same, as with Prothon it looks like it always relates to
> > the self object, whereas in a `with' clause you can make it relates to
> > any object you wish.
> 
> Just to confuse the issue, I'd like to point out that in Prothon, the
> leading dot does always relate to the self object, but the 'with' clause
> sets the self object to any object you want at any time.  So both statements
> above are true at once.  The concept of changing the self object on the fly
> is somewhat bizzare, much like changing the protoype on the fly, which you
> can also do.
> 
Out of curiousity (and on a somewhat related topic), how do you handle 
"class variables" - i.e., variables that exist in the "super" object, 
and should be accessable by all "sub objects"?

Accessing them is straightforward - for "foo.bar" if foo doesn't have 
bar, but it inherits from an object that does have bar, you get that, 
but what about foo.bar on the LHS of an expression?  So does "foo.bar = 
5" add a "bar" slot to "foo" or does it change bar in the parent object?

Self had a full blown system for variable access & setting, combined 
with its multiple inheritance for some pretty interesting abilities 
(essentially, all "getters" and "setters" were functions, so you could 
have something be a constant by only providing a getter, etc...)

NewtonScript actually had two different assignment operators "=" and 
":=" which determined how it behaved (though it got complex because it 
sort of had multiple inheritance - everything inherited from _two_ 
parents, the "real" parent and a "_proto", which seems strange, but it 
made sense in the runtime of the Newton, but that's a bit off topic).



More information about the Python-list mailing list