self.python vs Current.eiffel

Egbert Bouwman egbert at bork.demon.nl
Sat Sep 30 14:52:00 EDT 2000


On Sat, Sep 30, 2000 at 09:19:43AM +0000, Quinn Dunkan wrote:
> 
> So how are you supposed to have confusing variable names in eiffel if you
> can't assign to Current?  Or is Meyer just being Mr. Correct and not allowing
> us our little perversities?  :)

After Marcin's reply and a few more pages of Meyer's book
it really becomes quite simple:

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 .

If you allow qualified assignments, you can assign any value
from outside, not only the contextually valid ones. And that is not safe.
Yes, Mr Correct, Meyer himself, says you run the risk of producing an 
incorrect object.

If you want to change an instance variable, you should do it with
a function (ie a method in our parlance). Then you can test, reject,
adapt, etc the intended change.
Room enough for perversities, I suppose.
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.
egbert
-- 
Egbert Bouwman - Keizersgracht 197 II - 1016 DS  Amsterdam - 020 6257991
========================================================================




More information about the Python-list mailing list