[#1026] Is this a bug? — Dave Thomas <Dave@...>

18 messages 2000/01/03

[#1084] Infinite loop — Dave Thomas <Dave@...>

17 messages 2000/01/11

[#1104] The value of while... — Dave Thomas <Dave@...>

24 messages 2000/01/11

[ruby-talk:01109] Re: YADQ (Yet Another Dumb Question)

From: matz@... (Yukihiro Matsumoto)
Date: 2000-01-12 03:26:15 UTC
List: ruby-talk #1109
In message "[ruby-talk:01095] Re: YADQ (Yet Another Dumb Question)"
    on 00/01/11, Dave Thomas <Dave@thomases.com> writes:

|So... how about a compromise? We could have a global method, say
|'unset <list>', that unsets all the variables in it's list. That way,
|if you want to redefine a constant, you could:
|
|  module Math
|    unset PI
|    PI = 2
|  end

You can accomplish it by remove_const method

  module Math
    remove_const :PI
    PI = 2
  end

But it requires knowledge about the constants to overwrite.  For
example, to reload the program without error, you have to remove all
constants defined in the program before loading it.

I'm not sure what is the best way.

							matz.

In This Thread