self.python vs Current.eiffel

Darren New dnew at san.rr.com
Mon Oct 2 00:39:28 EDT 2000


Egbert Bouwman wrote:
> In Eifel you cannot say:
>    Current.x := Current.x + a
> because you cannot qualify the variable assigned to.
> And the assignment to x is really the assignment to Current.x .

It's actually pretty easy to understand. Instance variables in Eiffel are
read-only from outside the instance methods, because there shouldn't be any
syntactic difference between instance variables and functions of no
arguments. Indeed, a function of zero arguments can be overridden in a
subclass by a variable.

Hence, the *only* form of qualified assignment allowed would be Current.x,
since the only thing you are allowed to assign to from within Current is
Current. Hence, Current.x is treated as an expression (or "rvalue") not an
lvalue.

It's like saying "+x := 5" is not allowed, because "-x := 5" is not allowed.

> But I don't know yet how Meyer handles same named class variables and
> instance variables, if at all allowed. Give me a few days.

No class variables. Which I find odd. There's just work-around bits, like
"mix-in inheritance" and "once functions".

-- 
Darren New / Senior MTS & Free Radical / Invisible Worlds Inc.
San Diego, CA, USA (PST).  Cryptokeys on demand.
The tragedy of the commons applies to monitizing eyeballs, too.



More information about the Python-list mailing list