The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Dissecting matz's monster patch: lots of activity in 1.9

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Eigen Class

Posts: 358
Nickname: eigenclass
Registered: Oct, 2005

Eigenclass is a hardcore Ruby blog.
Dissecting matz's monster patch: lots of activity in 1.9 Posted: Jun 11, 2006 4:31 AM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Eigen Class.
Original Post: Dissecting matz's monster patch: lots of activity in 1.9
Feed Title: Eigenclass
Feed URL: http://feeds.feedburner.com/eigenclass
Feed Description: Ruby stuff --- trying to stay away from triviality.
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Eigen Class
Latest Posts From Eigenclass

Advertisement

At last, enough commit activity on HEAD to justify an update to my summary of changes in Ruby 1.9. It looked as if almost nothing had happened in the last three months (Akira's work on the non-blocking IO stuff and little more) and then came matz's gigantic patch with a load of Ruby2 features...

Syntax

Those who don't understand the meaning of the word "experimental" and foreboded Ruby's demise in the arcane syntax pit and, well, pretty much any Rubyist out there ;), will be happy to know that the ;; terminator and the ->(){} lambda notation are dead!

Some new syntax arrived to take the place of these syntactical failures, but it blends quite nicely with 1.8's.

As suggested by Audrey Tang, you can use several splat operators in a method call:

def foo(*a)
  a
end

foo(1, *[2,3], 4, *[5,6])                        # => [1, 2, 3, 4, 5, 6]

A slightly bolder addition allows you to use splats, "assocs" (hashes without braces) and block arguments with #[]:

RUBY_VERSION                                       # => "1.9.0"
RUBY_RELEASE_DATE                                  # => "2006-06-11"
class Foo; def [](*a, &block); block.call(a) end end

a = (0..3).to_a
Foo.new[*a, :op => :+]{|x| x }                     # => [0, 1, 2, 3, {:op=>:+}]

One character Strings

String#[] now returns a one-char-wide String instead of a Fixnum; String#[]=, IO#getc and the ?c syntax were changed accordingly. The new String#ord allows you to get your friendly Fixnum out of the String returned by String#[], so

'a'[0].ord

is equivalent 'a'[0] in 1.8.

Misc. new methods

A bunch of non-blocking methods in IO, Socket, TCPServer and UNIXServer, Proc#yield, __method__ and __callee__, Math#log2...

Summary of changes since the last update


Read more...

Read: Dissecting matz's monster patch: lots of activity in 1.9

Topic: When you’re happy with what you just did and have nothing else to post anyway Previous Topic   Next Topic Topic: Porting ruby-prof to Windows

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use