test_yaml.rb:
require 'yaml’
puts( true.to_yaml )
% ruby test_yaml.rb
prints:
/usr/local/lib/ruby/1.8/yaml/types.rb:49: warning: toplevel constant Hash
referenced by Kernel::Hash
– true
Is this behaviour common? Or I did something wrong. Thanks.
but it does not give me any warning on the Windows XP.
Thanks in advance
PS: I just copy /usr/local/lib/ruby/1.8/yaml directory to
c:\ruby\1.8.0\lib\yaml
“Useko Netsumi” REMOVE_THISusenets@nyc.rr.com wrote in message
news:bd8tjr$qp04v$1@ID-159205.news.dfncis.de …
···
test_yaml.rb:
require ‘yaml’
puts( true.to_yaml )
% ruby test_yaml.rb
prints:
/usr/local/lib/ruby/1.8/yaml/types.rb:49: warning: toplevel constant Hash
referenced by Kernel::Hash
– true
Is this behaviour common? Or I did something wrong. Thanks.
ts1
(ts)
24 June 2003 11:16
3
Is this behaviour common? Or I did something wrong.
No, the problem is in yaml which make reference to Kernel::Hash rather
than Object::Hash
Guy Decoux
If that’s true, then how come it did not give any error on windows?
Thanks in advance.
“ts” decoux@moulon.inra.fr wrote in message
news:200306241116.h5OBGnp06718@moulon.inra.fr …
···
Is this behaviour common? Or I did something wrong.
No, the problem is in yaml which make reference to Kernel::Hash rather
than Object::Hash
Guy Decoux
ts1
(ts)
24 June 2003 14:32
6
If that's true, then how come it did not give any error on windows?
It depend on the ruby version
svg% /usr/bin/ruby -ve 'p Kernel::Hash'
ruby 1.8.0 (2003-05-13) [i686-linux]
Hash
svg%
svg% ./ruby -ve 'p Kernel::Hash'
ruby 1.8.0 (2003-06-24) [i686-linux]
-e:1: warning: toplevel constant Hash referenced by Kernel::Hash
Hash
svg%
Guy Decoux
ts1
(ts)
26 June 2003 09:10
7
::Hash wouldn't be better?
Yes, this is just that I've not understood why he try to reference
Kernel::Hash (confusion between Kernel and Object for ::Hash ???)
Guy Decoux
It looks like almost anything would be better:
~$ ruby -v
ruby 1.8.0 (2003-06-23) [i686-linux]
~$ ruby -w
a = Kernel::Hash.new
b = Object::Hash.new
c = ::Hash.new
d = Hash.new
-:1: warning: toplevel constant Hash referenced by Kernel::Hash
Personally, I think Object::Hash, Kernel::Hash are silly, and ::Hash is ugly.
Why not just say “Hash”?
Jason Creighton
···
On Thu, 26 Jun 2003 09:46:50 +0900 nobu.nokada@softhome.net wrote:
Hi,
At Tue, 24 Jun 2003 20:16:53 +0900, > ts wrote:
Is this behaviour common? Or I did something wrong.
No, the problem is in yaml which make reference to Kernel::Hash rather
than Object::Hash
::Hash wouldn’t be better?
Thanks ts,
I download the new ruby-1.8preview3 for both the linux and the
windows(mswin32) version and run your command. Now both give me the same
warnings.
Ruby - MSWIN32
c:> c:\apps\ruby\bin\ruby -ve ‘p Kernel::Hash’
ruby 1.8.0 (2003-06-23) [i386-mswin32]
-e:1: warning: toplevel constant Hash referenced by Kernel::Hash
Hash
c:>
Ruby - Linux
% ruby -ve ‘p Kernel::Hash’
ruby 1.8.0 (2003-06-23) [i686-linux]
-e:1: warning: toplevel constant Hash referenced by Kernel::Hash
Hash
%
“ts” decoux@moulon.inra.fr wrote in message
news:200306241432.h5OEWgJ11444@moulon.inra.fr …
···
If that’s true, then how come it did not give any error on windows?
It depend on the ruby version
svg% /usr/bin/ruby -ve ‘p Kernel::Hash’
ruby 1.8.0 (2003-05-13) [i686-linux]
Hash
svg%
svg% ./ruby -ve ‘p Kernel::Hash’
ruby 1.8.0 (2003-06-24) [i686-linux]
-e:1: warning: toplevel constant Hash referenced by Kernel::Hash
Hash
svg%
Guy Decoux
Sorry. When I originally wrote that code, I was under the impression that
Kernel was the top level namespace. I will change to ::Hash, if it will
avoid further ambiguity. Thank you.
_why
···
On Thursday 26 June 2003 03:10 am, ts wrote:
Yes, this is just that I’ve not understood why he try to reference
Kernel::Hash (confusion between Kernel and Object for ::Hash ???)
Hi,
Personally, I think Object::Hash, Kernel::Hash are silly, and ::Hash is ugly.
Why not just say “Hash”?
Sometimes you have to stand ugliness, when Hash may be overridden.
class Foo
Hash = {}
def foo
p Hash
p ::Hash
end
end
Foo.new.foo
=> {}
Hash
···
matz.