Hi!
I wonder why ruby throws two warning messages when the follwing script
is executed:
[code]
#!/usr/bin/ruby -w
require 'date'
aktDate=Date.today
lastRun=aktDate
lastRun.upto(aktDate) do |tDate|
puts "#{tDate.day}.#{tDate.month}.#{tDate.year}"
end
[code]
Output:
dodger@satan:~/source/ruby$ ./dateTest.rb
(eval):4: warning: instance variable @__10761__ not initialized
(eval):4: warning: instance variable @__10337__ not initialized
23.7.2004
Someone any idea?
TIA,
SR
PS: System: Debian GNU/Linux Sid with Ruby 1.8.2pre1
···
--
Megahertz: A very large car rental agency.
- http://www.malerwerkst.at - (slow)
(Registered Linux-User #249081)
Hello.
(2004/07/23 09:51)
(eval):4: warning: instance variable @__10761__ not initialized
(eval):4: warning: instance variable @__10337__ not initialized
23.7.2004
This warning comes from Date#to_s, and the code below warns with same reason.
class Foo
def foo
if @val; end # evaluate uninitialized instance variable
end
end
Foo.new.foo
I don't know if this is intended warning. (1.8.1 doesn't warn)
···
Sebastian Ruhs <RembrandtAkaDodger@gmx.de> wrote:
Ok, if this warning comes from the use of an uninitialized instance
variable then there is a bug in the Date-class, right?
so long...
sR
···
Am 23.07.2004 schrieb H.Yamamoto:
>(eval):4: warning: instance variable @__10761__ not initialized
>(eval):4: warning: instance variable @__10337__ not initialized
>23.7.2004
This warning comes from Date#to_s, and the code below warns with same
reason.
class Foo
def foo
if @val; end # evaluate uninitialized instance variable
end
end
Foo.new.foo
I don't know if this is intended warning. (1.8.1 doesn't warn)
--
"Futile is resistance. Assimilated you will be, yes. Yoda of Borg I am."
[Unknown]
- http://www.malerwerkst.at - (slow)
(Registered Linux-User #249081)
Hello.
Ok, if this warning comes from the use of an uninitialized instance
variable then there is a bug in the Date-class, right?
I'm not sure I can call it a bug... I think this warning message is just telling us
"You are using uninitialized variable. Do you know what you are doing? Isn't there
any spelling miss?" like "if (fp = fopen(path, "r"))" in C-language.
But anyway, this was fixed by matz yesterday. It will be included in ruby-1.8.2pre2.