This post originated from an RSS feed registered with Ruby Buzz
by Red Handed.
Original Post: Block Terminator
Feed Title: RedHanded
Feed URL: http://redhanded.hobix.com/index.xml
Feed Description: sneaking Ruby through the system
Matz added new block terminator to 1.9 branch.
He thinks highly of “end”, ordinary block terminator, for reasons given below:
Because “end” means an end of a block obviously, a block can be an expression. This point is superior to Python whose block is nothing but statement.
Of course, you can do the same thing by using “{ ... }”, but “end” is more beautiful than that in case that a block has multiple paragraphs such as “case … when …” and “begin … rescue …”.
But He cares about that “end”’s visual inpact is a bit too far.
He was inspired by a new programing language Qu ,
then he add new block terminator ”;;”.
I tried it:
$ ./ruby1.9 -ve '
class Foo
def self.foo(x)
p x
;;
;;
Foo.foo "Hello, Qu!"
'
ruby 1.9.0 (2005-06-28) [i686-linux]
"Hello, Qu!"
Wow! How wonderful!
But He warned:
Don’t use this feature seriously. I may delete it without prior notice. —Oops, I should have done this on April Fool.