Project

General

Profile

Actions

Bug #1745

closed

Module#autoload No Longer Raises where 1.8 Does

Added by runpaint (Run Paint Run Run) over 15 years ago. Updated over 13 years ago.

Status:
Rejected
Target version:
ruby -v:
ruby 1.9.2dev (2009-07-08 trunk 23995) [i686-linux]
Backport:
[ruby-core:24213]

Description

=begin
There has been a change between 1.8 and 1.9 with Module#autoload when the autoloaded file doesn't declare the named class and the module is already open:

$ cat /tmp/autoload.rb
module Autoload
end
module Autoload
class W
autoload :Y, "/tmp/empty_file.rb"

   class Y
   end
 end

end

$ ruby86 -vw /tmp/autoload.rb
ruby 1.8.6 (2009-06-08 patchlevel 369) [i686-linux]
/tmp/autoload.rb:7: uninitialized constant Autoload::W::Y (NameError)

$ ruby -vw /tmp/autoload.rb
ruby 1.9.2dev (2009-07-08 trunk 23995) [i686-linux]

nobu's post in [ruby-core:19129] suggests that 1.8 is correct here. Is the 1.9 behaviour a bug?
=end

Actions #1

Updated by yugui (Yuki Sonoda) over 15 years ago

  • Assignee set to nobu (Nobuyoshi Nakada)
  • Priority changed from 3 to 5

=begin

=end

Actions #2

Updated by marcandre (Marc-Andre Lafortune) almost 15 years ago

  • Target version set to 1.9.2

=begin

=end

Actions #3

Updated by mame (Yusuke Endoh) over 14 years ago

=begin
Hi,

This behavior was changed at r22269, by nobu himself.
Nobu, please judge this.

--
Yusuke Endoh
=end

Actions #4

Updated by nobu (Nobuyoshi Nakada) over 14 years ago

  • Status changed from Open to Rejected

=begin
Intended change, because class/module definitions don't need presceeding constant definitions.
It creates new one or re-opens existing one.

Sorry but I can't remember where the discussion was in ruby-core, now.
=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0