Script_lines__

If the constant SCRIPT_LINES__ is defined and holds a hash, for each file
loaded after the constant definition the hash gets an entry that maps the
file name to an array of strings: the file lines.

Does anybody have a use case for this constant, or know the rationale
behind this feature?

Hi,

You can use this for debugging. If you extract the file name and line
number from the stracktrace of an error, you can print out the actual
line from SCRIPT_LINES__.

···

--
Posted via http://www.ruby-forum.com/.

Yes, they do use it. Also test coverage programs appear to use it.

···

--
Posted via http://www.ruby-forum.com/.

You can use this for debugging. If you extract the file name and line

number from the stracktrace of an error, you can print out the actual
line from SCRIPT_LINES__.

Is that an idea or do you mean Ruby debuggers do use that constant?

···

On Sun, Mar 18, 2012 at 10:13 PM, Jan E. <jan.e@online.de> wrote:

Unsubscribe Tombari Biranen

···

Sent from my BlackBerry wireless device from MTN

-----Original Message-----
From: Xavier Noria <fxn@hashref.com>
Date: Mon, 19 Mar 2012 06:21:03
To: ruby-talk ML<ruby-talk@ruby-lang.org>
Reply-To: ruby-talk@ruby-lang.org
Subject: Re: SCRIPT_LINES__

On Sun, Mar 18, 2012 at 10:13 PM, Jan E. <jan.e@online.de> wrote:

You can use this for debugging. If you extract the file name and line

number from the stracktrace of an error, you can print out the actual
line from SCRIPT_LINES__.

Is that an idea or do you mean Ruby debuggers do use that constant?

Xavier Noria wrote in post #1052200:

Is that an idea or do you mean Ruby debuggers do use that constant?

I don't know which programs actually use the constant. But does it even
matter? *You* can use it for whatever you want. :wink:

Anyway, this usecase is described in the Ruby book by Flanagan and
Matsumoto.

···

--
Posted via http://www.ruby-forum.com/\.

Hi Jan, thanks for your reply.

Xavier Noria wrote in post #1052200:

> Is that an idea or do you mean Ruby debuggers do use that constant?

I don't know which programs actually use the constant. But does it even
matter?

I wonder about real use cases.

···

On Sun, Mar 18, 2012 at 10:57 PM, Jan E. <jan.e@online.de> wrote: