Ruby-dev summary 18974-19032

Hi all,

This is a summary of ruby-dev ML in these days.

[ruby-dev:18978] st_foreach()

Takaaki Tateishi posted a patch which optimizes st_foreach(),
ruby’s internal hash table iterator. His patch:

http://kt-www.jaist.ac.jp/~ttate/ftp/ruby/ruby-1.7.x.st.c.3.diff.gz

This patch gives 2-4% reduction in execution time.

Matz basically agreed with this patch, but also pointed out that we
need better names for them.

[ruby-dev:18987] WinCE patch

Takaaki Uematsu posted a patch which makes ruby “Windows CE machine
ready”. This patch has been already applied to current CVS repository.

[ruby-dev:19002] Why to_ary is defined in URI?

See this code:

% ruby -ruri -e 'puts URI.parse("http://www.ruby-lang.org/")'
http
nil
www.ruby-lang.org
80
/
nil
nil

Kernel#puts converts an argument to the array with calling to_ary
(if the method is defined). With this issue, TANAKA Akira asked
two questions:

* Why URI#to_ary is defined?
* Why Kernel#puts calls to_ary?

Matz’s answer (on Kernel#puts):

* Because it is useful.

  Examples by this summary's author:

# example 1:  output list of lines
puts ARGF.map {|line| .... }

# example 2:  list load pathes
~ % ruby -e 'puts $:'

[ruby-dev:19009] ipaddr.rb

UMEMOTO Hajime released a new library ipaddr.rb, which handles
IP addresses (v4 and v6). Check it out from ruby CVS repository.
You can also get it via CVSWeb:

http://www.ruby-lang.org/cgi-bin/cvsweb.cgi/rough/lib/ipaddr.rb?cvsroot=src&rev=1.1

[ruby-dev:19011] open-uri - very easy net access library

TANAKA Akira released a new library open-uri.rb.
Check it out from RAA:

http://www.ruby-lang.org/en/raa-list.rhtml?id=758

NOTE: This library requires ruby 1.7.

[ruby-dev:19004] Re: deprecated method
[ruby-dev:19025] Re: Different caller(0) in trace_func when NameError from toplevel between 1.6 and 1.7

(Continued from [ruby-core:00575])

See this code:

% ruby -e '2.times { Object.new.type }'
-e:1: warning: Object#type is deprecated; use Object#class
-e:1: warning: Object#type is deprecated; use Object#class

It is too verbose that the same warning is displaies many times.
Nobuyuki Nakada once posted a patch which suppress this warning,
but the patch breaks current behaviors. A new framework is required
now. Matz has noted that the new framework must implement following
functions:

* multiple warning level
* only one warning per one appearance
* warning hook

– Minero Aoki

In article 20021209183912I.aamine@loveruby.net,
Minero Aoki aamine@loveruby.net writes:

* Why URI#to_ary is defined?

URI#to_ary is not defined.

% ruby -ruri -e ‘p URI.instance_methods.include?(“to_ary”)’
false

···


Tanaka Akira

Hi,

···

In message “Re: ruby-dev summary 18974-19032” on 02/12/10, Tanaka Akira akr@m17n.org writes:

* Why URI#to_ary is defined?

URI#to_ary is not defined.

% ruby -ruri -e ‘p URI.instance_methods.include?(“to_ary”)’
false

Yep, URI::Generic#to_ary to be precise.

						matz.