At 06:03 15/06/2004 +0900, you wrote: >Robert Klemme wrote: >..... >>What do you gain by undefining instance variables? If you access it via >>@foo it'll be nil anyway. > > >I did not advocate removing, a.k.a. undefining, >instance variable, I was just pointing out that >these removal methods exists - but since you asked: > >Removing an instance or class variable after >its usefulness expired (a typical example are >auxiliary instance variable used in nontrivial >initializers distributed over several auxiliary >methods) is IMO a good practice mainly for >esthetical reasons (akin to the well established >practice of always initialing instance variable >before using them) - on occasion you might even >catch an error this way. Another reason is that >unused instance variable take up unnecessary >memory space. > >It seems harder to me to make a similar compelling >stylistic (and memory) case for the existence of >removal methods for class variables and especially >for global variables, and removal method for local >variables make no sense at all. > >/Christoph OTOH things should be undoable. If you believe so then undefining a local variable (or whatever can be defined) makes *some* sense. I must confess that how to use such an undefine action in a clean way is something I have yet to figure out ;-) BTW: defined?() tells you about whether a variable is defined, including local ones. Yours, JeanHuguesRobert ------------------------------------------------------------------------- Web: http://hdl.handle.net/1030.37/1.1 Phone: +33 (0) 4 92 27 74 17