From: Craig Moran Date: 2005-07-12T04:25:52+09:00 Subject: Re: Standard Library Warnings ------=_Part_2968_6527735.1121109948562 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Apologies for the blank messages. Google's HTML email freaked out on me and= =20 sent these by mistake. Sorry again for the blank "noise." Craig On 7/11/05, Craig Moran wrote: >=20 > On 7/11/05, James Edward Gray II wrote: > > 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 =3D %w{ exit inc dec } > > > > ABBREV =3D COMMANDS.abbrev > > > > Readline.completion_proc =3D proc do |string| > > ABBREV[string] > > end > > > > value =3D 0 > > > > loop do > > > > cmd =3D readline("wibble [#{value}]: ", true) > > > > break if cmd.nil? > > > > case cmd.strip > > when "exit" > > break > > when "inc" > > value +=3D 1 > > when "dec" > > value -=3D 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 > > > > > > >=20 > ------=_Part_2968_6527735.1121109948562--