Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Robert Klemme Newsgroups: comp.lang.ruby Subject: Re: RubyWart: Missing Name Errors (AGAIN!) Date: Wed, 01 May 2013 11:27:49 +0200 Lines: 84 Message-ID: References: <178bbf18-32c2-4ecb-8318-972617bfb332@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Trace: individual.net eR3EZSqvQKBCHS7VPvpCIgV4EGPFa40usBBXMIUYaVsDdJMfo= Cancel-Lock: sha1:3fk8k8J98y2wgw8KzURaOj+4FCg= User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 In-Reply-To: <178bbf18-32c2-4ecb-8318-972617bfb332@googlegroups.com> Xref: csiph.com comp.lang.ruby:6792 On 05/01/2013 07:15 AM, rantingrickjohnson@gmail.com wrote: > Same bowel movement, different cess pool! > > Can someone please explain the logic of having undefined symbols defaul= t to random values instead of throwing a NameError? Because this is makin= g me F'ING NUTS PEOPLE!!!! They don't. Also, this is not about an undefined Symbol but about an=20 unassigned member variable. > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > Code Sample > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > class Foo > def foo > $stdout.write("@poo =3D #{@poo}\n") > end > end > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > Interactive Session > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > rb> f =3D Foo.new > # > rb> f.foo > @poo =3D 7 That output does not come from the code above: irb(main):001:0> class Foo irb(main):002:1> def foo irb(main):003:2> $stdout.write("@poo =3D #{@poo}\n") irb(main):004:2> end irb(main):005:1> end =3D> nil irb(main):006:0> f =3D Foo.new =3D> # irb(main):007:0> f.foo @poo =3D =3D> 8 What you probably did: irb(main):001:0> class Foo irb(main):002:1> def foo irb(main):003:2> $stdout.write("@poo =3D #{@poo}") irb(main):004:2> end irb(main):005:1> end =3D> nil irb(main):006:0> f =3D Foo.new =3D> # irb(main):007:0> f.foo @poo =3D =3D> 7 Whatever interactive Ruby you used does not print "=3D> " in front of the= =20 inspect of the last value. Now you also see why IRB does print this pref= ix. > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > Resulting Emotional State > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > =E0=B2=A0_=E0=B2=A0 It may actually be the other way round. Kind regards robert