Stéphane Ducasse wrote:
Well, with the presence of traits, i don't see how we could avoid that nicely.
May be I missed something but I do not see why? If I do not use in a trait a local variable that are the same name as an iv then I have no problem. So just using a different local or iv solve it.
Yes, but... ...then the author of the trait must know all of the IV names of all of the classes to which the trait might be applied, including ones not yet written. Since traits aren't allowed to reference any IV, this does seem like an unreasonable burden for the trait author. Or, conversely, the author of a new class that wants to apply one or more existing traits to the new class must know all of the temp variable names used by the trait, which also seems an unreasonable burden. The interaction between traits and classes should be defined solely by trait messages provided and required; the variable names used should not enter into it. I'd think that the desirable path would be to have arg and temp names shadow instvars, and that the tools would warn of this condition except in traits, where the shadowing would be silently accepted. Also desirable is for the tools to consider any access to an IV within a trait as an error. (Maybe the tools already do this?) Regards, -Martin