From: "David A. Black" Date: 2005-07-31T11:40:53+09:00 Subject: Re: make local var visible Hi -- On Sun, 31 Jul 2005, Trans wrote: > > David A. Black wrote: > >> It's fragile because it means you're coupling things that are in >> different scopes. You might, for example, want to refactor part of >> your program (put a class definition in another file, or whatever), >> and you'd have to keep track of these "local" variables because >> someone, somewhere, might have used your "local" variable in another >> scope with ::var or whatever. > > True. But wouldn't you be facing the same thing by using Const, $var, > or @@var? Nonethless you make it clear that good coding practices, like > SOC, is the way to go. > >> Keep in mind that with Class#new, class_eval, define_method, closures, >> and other such tools, you can do a fair amount of scope-capturing >> already. I think part of the point of the class and def keywords is >> to seal off the scope of local variables. > > And thus enforcing good coding practices? I think it at least provides an environment conducive to good practices. David -- David A. Black dblack@wobblini.net