Project

General

Profile

Actions

Bug #1982

closed

Kernel.load(..., true) --> scope problem

Added by johan556 (Johan Holmberg) over 15 years ago. Updated over 13 years ago.

Status:
Closed
Target version:
ruby -v:
ruby 1.9.2dev (2009-07-18 trunk 24186)
Backport:
[ruby-core:25039]

Description

=begin
In a file loaded with "Kernel.load(..., true)", the way constants are looked up has changed since 1.8. The attached script "helloworld.rb" works in Ruby 1.8, but fails in Ruby 1.9. It should be invoked like below to provoke the error:

 $ ruby1.9 -e 'load "helloworld.rb", true'

The error I get is:

helloworld.rb:8:in say': uninitialized constant #<Module:0x2c9764>::HelloWorld::Hello (NameError) from helloworld.rb:12:in <top (required)>'
from -e:1:in load' from -e:1:in '

The behaviour of 1.9 seems like a bug to me. It makes it almost impossible to write code in a file loaded this way (with the "true" parameter to "Kernel.load").

( see also my previous mail about this in [ruby-core:22033] )
=end


Files

helloworld.rb (348 Bytes) helloworld.rb johan556 (Johan Holmberg), 08/23/2009 05:32 AM

Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #616: instance_eval and Module#to_sClosedko1 (Koichi Sasada)10/06/200801/20/2009Actions
Actions #1

Updated by yugui (Yuki Sonoda) over 15 years ago

  • Assignee set to matz (Yukihiro Matsumoto)
  • Target version set to 1.9.2
Actions #2

Updated by yugui (Yuki Sonoda) over 15 years ago

  • Status changed from Open to Assigned
  • Priority changed from Normal to 5
Actions #3

Updated by mame (Yusuke Endoh) over 14 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r27514.
Johan, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0