Couple of questions about constant lookups

C

Chris Roos

I asked something along these lines recently (subject: "const_defined?
not quite in sync with const_get ??"). I don't think this exact case
was addressed in that mail but I apologise if it was..

I'm wondering why the last two lines in the code snippet below result
in different output.

-- code --

module Foo; end
class Bar; end

p Foo::Array #=> NameError: uninitialized constant Foo::Array
p Bar::Array #=> warning: toplevel constant Array referenced by Bar::Array

-- /code --

Cheers,

Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,197
Latest member
Sean29G025

Latest Threads

Top