誤報

Ruby勉強会@関西 4 の内容に関して、

8月にはRubyの書籍も出るらしい

なんて、角谷さんから期待 age (まぁ私が書く訳じゃないんですが) されていたのですが、誤報撒いたみたいです。


私が言っていたのは、恐らく、RHG 読書会 - 青木日記/T(2005-07-23)のコレ:

  • 高橋さん + もりきゅうさんの Rails 原稿を読んだ。次の WEB+DB press は買おう。

書籍じゃなくて記事だったみたい…。どうりで、私が知っていて東京の人達が知らないなんておかしいなーと思っていたんですよ。なにぶん伝言ゲームで伝わってきたもんで、ワハハ。いや、ごめんなさい orz。


あ、別の雑誌(ムック?)で Rails 記事があるよ!<これは、本人確認済
(本人が発売1週間前ぐらいに告知するそうです。)

lambda 式 (2)

も加えてみる。


Matz is thinking about new syntax of block paremter and lambda expression.
As it stands, we can't use same syntax as method parameter in block parameter.
So he has someideas, but he is not satisfied with these ideas.


We can write block parameters like this now:

hash.each { |k,v| v ||= "none"; ... }

Following examples mean the same.

Anonymous function like Perl6


This syntax came from Perl6:

for list -> x { ... }

Perl6 has a near cultural sphere to Ruby, so he think it's well to refer Perl6.
But he worry whether Perl6 will be released or not and whether this syntax will be adopted in Perl6 or not.(★一文で whether 2度使うと変じゃない?)

hash.each -> (k,v="none") { ... }

This syntax is so-so in block because It reminds me of a substitution.


But when in lambda expression:

proc = -> (x, y) { ... }

Hmmm, it doesn't look like a function.(★関数っぽくない)


Other sign

hash.each \(k,v="none") { ... }

In Haskell, back-slash sign means lambda because of form likeness.
A matter is that back-slash sign displays as yen-sign by font.

In lambda case:

proc = \(x, y) { ... }

In Ruby, it look like a parenthesis escaped.


Double back-slash

hash.each \\(k,v="none") { ... }

It's lack of visual hint.

proc = \\(x, y) { ... }

He thinks better than one back-slash case.
He is worried by the same reason of font as one back-slash, too.

He thinks he should lays special emphasis on lambda expression,
because main dissatisfaction was an inconsistency that
a syntax of lambda's parameters is different from syntax method's parameter in the begining.(★長ぇ〜)
(See Function Call)


Though he will not choice below ideas probably, I introduce.

New keyword

hash.each { using k,v="none"; ... }

Extend lambda

hash.each(&lambda(k,v="none") { ... })


He leaned toward an example like Perl6 and had done at his local repository, but he wavers yet.
He wants a good idea which fulfill below condition:

  • It's able to express anonymous function.
  • It puts in front of paraemters.
  • It's good mix of sign which have not been used until now.
  • Many people feel comfortable (if possible).

What do you think?



理由は書かずにコード例でヤイヤイ話題にしてもらった方が良いような気がしてきた今日この頃。