From: Christoph Date: 2004-06-14T09:38:38+09:00 Subject: Re: undefine tony summerfelt wrote: .... > in my particular case i'm thinking black box approach. i don't want > the variable to 'exist' any more. > > i don't know if that's how it's thought of in perl, but when i > undef($x), $x is no longer there for me to use unless i assign it > something, and i can test that it isn't with: > > if ! defined($x) # do something. > > as long as ruby 'acts' the same way, it's all i need. I am aware of this kind of functionality for instance and class variables - for local or global variables such methods, afaik (I am not really sure!!!) don't exist. I see no problems with a removal method for global variables but we are probably better off without removal methods for local variables. --- class A @x = 1 @@x = 1 $x = 1 x = 1 remove_instance_variable :@x remove_class_variable :@@x begin remove_gobal_variable :$x rescue => mes puts mes end begin remove_local_variable :x rescue => mes puts mes end end --- undefined method `remove_gobal_variable' for A:Class undefined method `remove_local_variable' for A:Class --- /Christoph