Block Terminator
オリジナルは Matzにっき(2005-06-07) by まつもとさん です。
晒してみる。布団を干すような感覚で。
This entry is loose translation of "matz blog 2005-06-07":http://www.rubyist.net/~matz/20050607.html#p02 .
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":http://centrin.net.id/~marc/index.html ,
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 withoutwarningprior notice.*1
fn1.Oops, I should have done this on April Fool.