[#28687] [Bug #2973] rb_bug - Segmentation fault - error.c:213 — rudolf gavlas <redmine@...>

Bug #2973: rb_bug - Segmentation fault - error.c:213

10 messages 2010/03/16

[#28735] [Bug #2982] Ruby tries to link with both openssl and readline — Lucas Nussbaum <redmine@...>

Bug #2982: Ruby tries to link with both openssl and readline

16 messages 2010/03/18

[#28736] [Bug #2983] Ruby (GPLv2 only) tries to link to with readline (now GPLv3) — Lucas Nussbaum <redmine@...>

Bug #2983: Ruby (GPLv2 only) tries to link to with readline (now GPLv3)

10 messages 2010/03/18

[#28907] [Bug #3000] Open SSL Segfaults — Christian Höltje <redmine@...>

Bug #3000: Open SSL Segfaults

19 messages 2010/03/23

[#28924] [Bug #3005] Ruby core dump - [BUG] rb_sys_fail() - errno == 0 — Sebastian YEPES <redmine@...>

Bug #3005: Ruby core dump - [BUG] rb_sys_fail() - errno == 0

10 messages 2010/03/24

[#28954] [Feature #3010] slow require gems in ruby 1.9.1 — Miao Jiang <redmine@...>

Feature #3010: slow require gems in ruby 1.9.1

15 messages 2010/03/24

[#29179] [Bug #3071] Convert rubygems and rdoc to use psych — Aaron Patterson <redmine@...>

Bug #3071: Convert rubygems and rdoc to use psych

10 messages 2010/03/31

[ruby-core:28416] [Bug #1666] Confusion in documentation for lines vs each_line, etc...

From: Yusuke Endoh <redmine@...>
Date: 2010-03-02 12:07:01 UTC
List: ruby-core #28416
Issue #1666 has been updated by Yusuke Endoh.


Hi,

> Currently, IO#lines is defined as "to_enum(:each_line, *args)" and thus will ignore a block if one is given.
> On the other hand, String#lines and String#each_line are aliases, and thus will both execute the block, if one given. The same is true for StringIO#lines and StringIO#each_line.

I think the inconsistency is caused by accident.  Traditionally,
String#lines had returned an Enumerator ignoring a given block.
And it was changed at r11186 because of [ruby-core:09218].
I can find no reason why IO#lines are not changed similarly.
I guess it is just forgotten.


In addition, ARGF works similarly to String:

  $ echo -e "foo\nbar\nbaz" | ./ruby -e '$<.lines {|x| p x }'
  "foo\n"
  "bar\n"
  "baz\n"

  $ echo -e "foo\nbar\nbaz" | ./ruby -e 'p $<.to_io.lines {|x| p x }'

This is apparently strange.  So, I'll fix it soon by changing IO#
lines, etc.  I'll also fix RubySpec.
(Of course, I'll revert this if matz says this is intended)


> the documentation is different for String#lines vs String#each_line, #bytes vs #each_byte, #chars vs #each_char  (although they are aliases).

Seems the same historical reason.

However, I wonder matz may still want people to use #each_line to
iterate and #lines to make an Enumerator, respectively.


> StringIO#bytes, #lines & #chars are not documented at all.
> In all cases, the documentation for String should be cleaned up

As you can see, my English is very poor.  So I'll leave it to you.
Before you commit, please let us review a patch.

-- 
Yusuke Endoh <mame@tsg.ne.jp>
----------------------------------------
http://redmine.ruby-lang.org/issues/show/1666

----------------------------------------
http://redmine.ruby-lang.org

In This Thread