Block Terminator

オリジナルは Matzにっき(2005-06-07) by まつもとさん です。

This entry is loose translation of "matz blog 2005-06-07": .

Matz added new block terminator to 1.9 branch.

He thinks highly of "end", ordinary block terminator, for reasons given below:

  • Because "end" means block end 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
p x
;; "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 warning prior notice.*1

fn1.Oops, I should have done this on April Fool.