I keep running into some warning message from standard libraries. I always use warnings so they are driving me crazy.
With the latest release of HighLine, I actually had to build a work-around that captures, disables, and later resets the warning level when calling into readline, because it's my opinion that the warning breaks auto-completion (the warning appears in the middle of your completed word).
Given that, I thought I would post some warning firing examples in the attempt to get some Ruby core hacker to feel sorry for me and apply a patch or two. I looked at patching set.rb myself but it seems that there is a hack in there to work around this warning and I couldn't figure out why it doesn't work.
Here are my examples:
$ ruby -v
ruby 1.8.2 (2004-12-25) [powerpc-darwin7.7.0]
$ cat set_example.rb
require "set"
SortedSet.new
$ ruby -w set_example.rb
(eval):2: warning: method redefined; discarding old initialize
$ cat prog_ruby_example_723.rb
# Sample code from Programing Ruby, page 723
require 'readline'
include Readline
require 'abbrev'
COMMANDS = %w{ exit inc dec }
ABBREV = COMMANDS.abbrev
Readline.completion_proc = proc do |string|
ABBREV[string]
end
value = 0
loop do
cmd = readline("wibble [#{value}]: ", true)
break if cmd.nil?
case cmd.strip
when "exit"
break
when "inc"
value += 1
when "dec"
value -= 1
else
puts "Invalid command #{cmd}"
end
end
$ ruby -w prog_ruby_example_723.rb
wibble [0]: dprog_ruby_example_723.rb:19: warning: instance variable completion_case_fold not initialized
ec
In that last example, I pushed d then tab to trigger the warning.
Let me know if I can answer any questions and thanks in advance for taking pity on a warnings-allergic coder.
James Edward Gray II