[#25936] [Bug:1.9] [rubygems] $LOAD_PATH includes bin directory — Nobuyoshi Nakada <nobu@...>

Hi,

10 messages 2009/10/05

[#25943] Disabling tainting — Tony Arcieri <tony@...>

Would it make sense to have a flag passed to the interpreter on startup that

16 messages 2009/10/05

[#26028] [Bug #2189] Math.atanh(1) & Math.atanh(-1) should not raise an error — Marc-Andre Lafortune <redmine@...>

Bug #2189: Math.atanh(1) & Math.atanh(-1) should not raise an error

14 messages 2009/10/10

[#26222] [Bug #2250] IO::for_fd() objects' finalization dangerously closes underlying fds — Mike Pomraning <redmine@...>

Bug #2250: IO::for_fd() objects' finalization dangerously closes underlying fds

11 messages 2009/10/22

[#26244] [Bug #2258] Kernel#require inside rb_require() inside rb_protect() inside SysV context fails — Suraj Kurapati <redmine@...>

Bug #2258: Kernel#require inside rb_require() inside rb_protect() inside SysV context fails

24 messages 2009/10/22

[#26361] [Feature #2294] [PATCH] ruby_bind_stack() to embed Ruby in coroutine — Suraj Kurapati <redmine@...>

Feature #2294: [PATCH] ruby_bind_stack() to embed Ruby in coroutine

42 messages 2009/10/27

[#26371] [Bug #2295] segmentation faults — tomer doron <redmine@...>

Bug #2295: segmentation faults

16 messages 2009/10/27

[ruby-core:26306] Re: IO.foreach (and friends) effect on $< and $.

From: Charles Oliver Nutter <headius@...>
Date: 2009-10-26 02:11:28 UTC
List: ruby-core #26306
More inconsistency: setting $. updates ARGF.lineno in all versions,
but when it is updated for IO.foreach, it does *not* update
ARGF.lineno:

~ ➔ ruby1.9 -e '$. = 1; p $<.lineno'
1

~ ➔ ruby1.9 -e 'IO.foreach("projects/jruby/build.xml"){}; p $.; p $<.lineno'
1775
0

It does not seem like $. should update ARGF, since the file being
iterated may not be (and usually is not) related to ARGF. I guess I'm
a little unclear why any update of $. alone should affect ARGF in any
way.

- Charlie

On Sun, Oct 25, 2009 at 8:38 PM, Charles Oliver Nutter
<headius@headius.com> wrote:
> I have a few questions about how the line-by-line IO operations are
> *supposed* to affect the ARGF global $< and the line number global $.
>
> First off, it seems a bit inconsistent whether $< should be updated
> for non-ARGF line iterations:
>
> ~/projects/jruby ➔ ruby -v -e 'p $<.lineno; IO.foreach("build.xml")
> {}; p $<.lineno'
> ruby 1.8.6 (2008-08-11 patchlevel 287) [universal-darwin9.0]
> 0
> 1775
>
> ~/projects/jruby ➔ ruby1.8.7 -v -e 'p $<.lineno;
> IO.foreach("build.xml") {}; p $<.lineno'
> ruby 1.8.7 (2009-09-11 patchlevel 202) [i686-darwin9.8.0]
> 0
> 1775
>
> ~/projects/jruby ➔ ruby1.9 -v -e 'p $<.lineno; IO.foreach("build.xml")
> {}; p $<.lineno'
> ruby 1.9.2dev (2009-07-23 trunk 24248) [i386-darwin9.7.1]
> 0
> 0
>
> It seems like 1.9 is "correct" here. JRuby acts like 1.8 regardless of
> 1.8 or 1.9 mode.
>
> Second, the $. variable. It appears to be consistently updated for all
> Ruby versions, but I wonder whether it's useful if it isn't
> thread-local. Thread-local would be better because multiple threads
> iterating lines would not all be setting the same variable.
>
> - Charlie
>
>

In This Thread