Ruby 1.8 differences?

Can anybody point me at a list of what’s changed in Ruby
version-for-version? I’m reading the web-based docs and I’d like to
know what’s improved in the version I’ve started using (1.8.13rc2 as
of yesterday if memory serves). On Windows (he ducks)…!

Here’s a good article by Why,

http://www.whytheluckystiff.net/articles/rubyOneEightOh.html

···

— Glenn glenn_m_smith@hotmail.com wrote:

Can anybody point me at a list of what’s changed in Ruby
version-for-version? I’m reading the web-based docs and I’d like to
know what’s improved in the version I’ve started using (1.8.13rc2 as
of yesterday if memory serves). On Windows (he ducks)…!


Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs
http://hotjobs.sweepstakes.yahoo.com/careermakeover

http://www.whytheluckystiff.net/articles/rubyOneEightOh.html

http://dev.faeriemud.org/changes-1.8.0.html

···

On Sun, 02 May 2004 11:13:24 -0700, Glenn wrote:

Can anybody point me at a list of what’s changed in Ruby
version-for-version? I’m reading the web-based docs and I’d like to know
what’s improved in the version I’ve started using (1.8.13rc2 as of
yesterday if memory serves). On Windows (he ducks)…!

Can anybody point me at a list of what’s changed in Ruby
version-for-version? I’m reading the web-based docs and I’d like to
know what’s improved in the version I’ve started using (1.8.13rc2 as
of yesterday if memory serves). On Windows (he ducks)…!

Here’s a good article by Why,

http://www.whytheluckystiff.net/articles/rubyOneEightOh.html

This is incredibly useful ! I specially liked the sort_by thing.

I started refactoring my code to use it. But I use a lot of sort!()
and sort_by! does not exists :frowning:

Question : Why no sort_by!() ?
Nota: Maybe I should not use sort!() that much. In some cases
I am assuming that it will be more efficient than x = x.sort(),
but I may be wrong.

initialize_copy() is great too. For a long time I was unsure
about how to implement copy constructors. Most of the time
my initialize() had to look at its parameters to figure out
what to do and to copy construct if one its parameter was
another object to use as a prototype. Now, I can get rid of
that ugly code.

Yours,

Jean-Hugues

···

At 03:31 03/05/2004 +0900, you wrote:

— Glenn glenn_m_smith@hotmail.com wrote:


Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs
http://hotjobs.sweepstakes.yahoo.com/careermakeover
hotjobs.sweepstakes.yahoo.com/careermakeover


Web: @jhr is virteal, virtually real
Phone: +33 (0) 4 92 27 74 17

Great too. I liked the Set class, great reading to learn
Ruby.

I tried Symbol#intern, strangely it is not defined for me…
So I keep my “class Symbol; def intern() self end end”
RUBY_VERSION == “1.8.1”, RUBY_PLATFORM == “i386-mswin32”
Typo ?

Yours,

Jean-Hugues

···

At 06:03 03/05/2004 +0900, you wrote:

On Sun, 02 May 2004 11:13:24 -0700, Glenn wrote:

Can anybody point me at a list of what’s changed in Ruby
version-for-version?
http://dev.faeriemud.org/changes-1.8.0.html


Web: @jhr is virteal, virtually real
Phone: +33 (0) 4 92 27 74 17

Thanks Tim!

sort_by is a more efficent way of Schwartzian Transform (because it’s
implemented in C). So instead of

ary.map {|x| [f(x), x] }.sort {|(ka,),(kb,)| ka <=> kb }.map { |k,v| v }

you can just write:

ary.sort_by { |x| f(x) }

Temporary arrays are created anyway. That’s why it is not useful to have
sort_by!. In general Schwartzian Transform is a stupid idea, especially
for large arrays, but sometimes it’s possible to find a function f with
an image that can be used for comparing the values more efficiently than
the values themselves.

Here’s a perl-centered paper about a lot of sorting tricks, but most of
it is also true for Ruby: “A Fresh Look at Efficient Perl Sorting”,
http://www.sysarch.com/perl/sort_paper.html

···

On 2004-05-03 20:23:41 +0900, Jean-Hugues ROBERT wrote:

I started refactoring my code to use it. But I use a lot of sort!()
and sort_by! does not exists :frowning:

Question : Why no sort_by!() ?


c, s, x = gets, c[0, 2].to_i, “dsfd;kfoA,.iyewrkldJKDHSUB”
puts (1…(c.size / 2)).inject(“”) do |p, i|
p << (c[2 * i, 2].to_i(16) ^ x[(s += 1) && s - 1])
end

http://dev.faeriemud.org/changes-1.8.0.html

I tried Symbol#intern, strangely it is not defined for me…
So I keep my “class Symbol; def intern() self end end”
RUBY_VERSION == “1.8.1”, RUBY_PLATFORM == “i386-mswin32”
Typo ?

Yours,

Jean-Hugues

#to_sym seems to be preferred over #intern.

h = ‘Hello’.to_sym

p h # (from String) #-> :Hello
p h.to_sym # (from Symbol) #-> :Hello
p h.to_i.to_sym # (from Fixnum) #-> :Hello

<doc\ChangeLog>

···

On 2004/05/03, Jean-Hugues ROBERT wrote:

Sat Nov 2 00:38:55 2002 Yukihiro Matsumoto matz@ruby-lang.org

  • object.c (sym_to_sym): rename from Symbol#intern

.
.
.

Fri Mar 23 09:49:02 2001 Yukihiro Matsumoto matz@ruby-lang.org

  • object.c (sym_intern): new method.

</>

daz