From: Christian Szegedy Date: 2002-09-16T18:28:45+09:00 Subject: Re: private variables William Djaja Tjokroaminata wrote: > Kent Dahl wrote: > >>I'd prefer having something explicit like: >> private_variables :some, :privvy, :vars, :listed, :here >>making @some, @privvy, @vars, @listed and @here private in that class. I think this is a matter of taste, but for me a naming convention seems to be better, since it would be simpler to tell the difference for a particular variable. > > I am not an expert in Ruby parser/interpreter at all (let alone computer > science), but to me this seems perfectly doable. I.e., after the > detection of keyword "private_variables", all public variables in the list > are moved from the current (public) instance variable hash to the private > instance variable hash. And then writing and reading the instance > variables are like in my other post. > It would mean a slight slowdown for the access of all instance variables, since you would need two hash lookups instead of one. If you use the naming convention, the parser would be able to generate a node for the correct hash lookup: you need only one (like now). Best Regards, Christian