Hi all,
This is a summary of ruby-dev ML in these days.
[ruby-dev:18651] Enumerable#zip (contd.)
Matz has noted some preconditions about this issue:
* The main reason to introduce Enumerable#zip is the parallel
iteration (to be precise, "finite parallel each").
* We should not use Thread/Continuation.
* We should not use external iterator (Iterator pattern).
* (on zip) We should not raise exceptions when the length of the
components are differ.
Under these conditions, following candidates are remained:
# Enumerable#zip
for x,y in a.zip(b) do ... end
a.zip(b).each {|x,y| ...}
# Problem: If the length of a and b are different,
# which one should we choose? The default value/block does
# not resolve this problem, because it is equal to the
# "choose longest" strategy.
# Enumerable#sync_each
a.sync_each(b,c) {|a,b,c| ... }
# Problem: "sync_each" is not a good name.
Following candidates have been already rejected:
# Array.zip --- "Array." is too redundant for our aim.
for x,y in Array.zip(a,b) do ... end
Array.zip(a,b).each {|x,y| ...}
# Enumerable#map_with_index --- too long description.
a.map_with_index {|x,idx| [a, b[idx]] }.each {|x,y| ... }
# Array#zip --- Temporal object (an array in this case)
# should not be a receiver.
for x,y in [a,b].zip do ... end
[a,b].zip.each {|x,y| ... }
# Kernel#zip --- We already have too many toplevel methods.
zip(a,b).each {|x,y| ... }
[ruby-dev:18711] another implementation of pstore
Current pstore.rb may crash a database file when a ruby process
is interrupted on certain bad timings. YANAGAWA Kazuhisa announced
his implementation of pstore.rb, which resolves such problems.
You can get it from:
http://www.dm4lab.to/~kjana/ruby/ps.tar.gz
NOTE: He does NOT intend on replacing current implementation.
This is just a sample, by now.
[ruby-dev:18739] change chomp!
Shin-ichiro HARA suggested that String#chomp should cut off
CR and LR at once. Knu pointed out that ruby 1.7 already acts
like such.
– Minero Aoki