Project

General

Profile

Actions

Feature #1591

closed

DATA handle unusable in required modules

Added by cdavaz (Chris Davaz) almost 15 years ago. Updated about 12 years ago.

Status:
Rejected
Target version:
-
[ruby-core:23766]

Description

=begin
I have a Module defined in a file that gets required by a script. Inside the module I set a class variable:

module MyModule
class MyClass
@@data = DATA.readlines
def MyClass.getData
return @@data
end
# ...
end
end

END
lots
of
words
...

DATA is undefined! If I add an END section to the script that requires my module, DATA becomes defined and it contains the data in the script. Obviously the way this works makes DATA + END useless except for the one case where a person wants to access END data from within their own script. I would think the more common case would be a module requires a bunch of data and it is convenient to just put that at the end of the file that contains the module and load it up when it gets required.
=end

Actions #1

Updated by nobu (Nobuyoshi Nakada) almost 15 years ago

  • Category set to core
  • Assignee set to matz (Yukihiro Matsumoto)
  • Target version set to 3.0

=begin

=end

Actions #2

Updated by shyouhei (Shyouhei Urabe) over 13 years ago

  • Status changed from Open to Assigned

=begin

=end

Actions #3

Updated by naruse (Yui NARUSE) over 12 years ago

  • Project changed from Ruby master to 14
  • Category deleted (core)
  • Target version deleted (3.0)
Actions #4

Updated by naruse (Yui NARUSE) over 12 years ago

  • Project changed from 14 to Ruby master

Updated by mame (Yusuke Endoh) about 12 years ago

  • Status changed from Assigned to Rejected

I'm rejecting this feature ticket because no progress has been
made for a long time. See [ruby-core:42391].

This feature is difficult to implement in terms of resource of
file descriptor. The interpreter must keep the descriptor of
each source file that ends with END because the content may
be accessed. This leads to a shortage of file descriptor.

AFAIK, DATA and END came from Perl. The behavior of Ruby
is also the same as Perl's.

--
Yusuke Endoh

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0