On Jul 12, 2005, at 9:30 AM, daz wrote:

> Are you referring to this as the hack (in Class SortedSet) ?
>     def setup # :nodoc:
> (:nodoc: is an RDoc instruction)

No, I was referring to the one just a few lines down:

       module_eval {
         # a hack to shut up warning
         alias old_init initialize
         remove_method :old_init
       }


>> $ ruby -w set_example.rb
>> (eval):2: warning: method redefined; discarding old initialize
>>
>
> Trying #remove_method before redefine gains a different warning:-/
>
>   lib/ruby/1.8/set.rb:457: warning: removing `initialize' may cause  
> serious problem
>
> Only option seems to be temporary "$VERBOSE = false".
> Just 4 lines to add:
>
>
> --- set_ORIG.rb 2004-12-18 04:07:28.000000000 +-0100
> +++ set.rb 2005-07-12 15:21:48.000000000 +-0100
> @@ -440,19 +440,22 @@
>      def setup # :nodoc:
>        @@setup and return
>
>        begin
>   require 'rbtree'
>
> + $VERBOSE, verbose = false, $VERBOSE
>   module_eval %{
>     def initialize(*args, &block)
>       @hash = RBTree.new
>       super
>     end
>   }
> + $VERBOSE = verbose
>        rescue LoadError
> + $VERBOSE, verbose = false, $VERBOSE
>   module_eval %{
>     def initialize(*args, &block)
>       @keys = nil
>       super
>     end
>
> @@ -497,12 +500,13 @@
>
>     def to_a
>       (@keys = @hash.keys).sort! unless @keys
>       @keys
>     end
>   }
> + $VERBOSE = verbose
>        end
>
>        @@setup = true
>      end
>    end

I hope someone will apply that to Ruby.  Thanks for looking into it!

James Edward Gray II