Bitwise MagazineでのRubyの紹介。
Bitwiseについては「4月に紹介するからなんか一言」と言われていたのに、 ほったらかしにしてしまっていたのだった。 4月になっても出たという話を聞かないから「企画が没になったのかな」と 思っていたのだが、2ヶ月ほど遅れて登場した、ということらしい。
こっちはまあ、普通。
しかし、もう一本あるのだ。
タイトルがふるっている。
Ruby programming's hidden treasure..? or a flawed gem..?
だそうだ。「Flawed」とは「偽の」とかいう意味だから、 「見かけ倒しの宝石(なの?)」という感じか。
まあ、「驚き最少の原則に反している」だの、 「全然シンプルな文法じゃない」だの、言いたい放題(笑)。
まあ、本当のことだけど。
ただ、「驚き最少の法則」は私が言い出したことじゃないんだけどなあ。 まあ、いつものことだよなあ。万人が驚かない言語なんて不可能だってば。 私自身は口にしないようにしてから3,4年は経つと思うんだけど、 まだこんなこと言われるんだよなあ。
さて、こんなにけちょんけちょんにけなしているように見えるのだが、 最後にはほめられているようだ。
Huw: Look, in all this discussion, it sounds as though both of us have been picking holes in Ruby. Anyone would think we didn’t like the language. That obviously isn’t true.
...obviously, both of us must feel that Ruby is a pretty interesting language. Let's wrap this up by trying to pick out the features that appeal to us. For myself, I think I'd say that it's the combination of reasonably thorough object orientation with a lightweight syntax. In my experience, Ruby is the most truly OOP language I've ever used with the sole exception of Smalltalk. Now, I am not completely obsessed with OOP - but it seems to me that either a language should do object orientation properly or it should leave it alone. Having decided to go for OOP, at least Ruby has, unlike most other supposedly `OOP languages' done it thoroughly. And, unlike Smalltalk, it has a simple syntax and isn't weighed down by being embedded into a hermetically sealed world \u2013 the entire environment that Smalltalk is obliged to carry around with it. In short, Ruby is, in principle, a perfect Rapid Application Development language.
Dermot: I'd agree there. Ruby is one of the most interesting languages around - certainly, the most interesting that I've seen in a long time. It makes a pleasant change from the endless variations of the C syntax that seem to come out (C++, Java, C# and so on). I particularly like the fact that while it is indeed object oriented, you don't need to know that to do simple stuff: I think mixins are brilliant!
さて、最後に面白かったところを二ヶ所ほど引用しておこう
And while I complain about the syntax (I’ve lost count of the number of times that I’d like to do something unpleasant to Matz!), writing a parser for Ruby, as I've been doing, is a whole lot different from using the Ruby language itself to do something useful.
なんだかおっかないことが書いてある。bitwise編集部には近づかないようにしよう。
Now that's a strange thought - could Ruby be the new VB?
「新たなVBとしてRubyを」ってことだけど、彼はVBの前の名前がRubyだったと知ったらどう思うだろうか。単なる偶然だけど。
前にも書いた
def foo(a,*b,c) end
のようなコードを実現した。ノードを変えちゃったので、 ripperやyarvへの対応が必要だけど、現時点ではほったらかし。
なかなか便利な気がする。オプションハッシュの取り出しとか。
どんなふうに便利かよくわからないので、解説希望です。
RCR315を参照してください
http://www.rcrchive.net/rcr/show/315
オプションハッシュを一番最後の引数として取り出したいとき、[]=メソッドで代入する値を取り出すときなどを想定しています。
>私自身は口にしないようにしてから3,4年は経つと思うんだけど、まだこんなこと言われるんだよなあ。
2002年のスライドでMatzさんが発表した発言を明確に打ち消していない(ですよね?)のに、「口にしないようにしている」だけでボヤくのはちょっと後だしジャンケン気味だなぁと思います。
ruby-talkをはじめとして何度も打ち消してると思います。
まあ、「私は〜してるのにまだわからないとは何事か」というニュアンスじゃなくて、「〜してても、何年経ってもやっぱり言われちゃうのね」という「ボヤき」なんで、勘弁していただきたく。
flawは宝石の傷
おお、では、「傷物の宝石」というのが適切な訳なんですね。
ありがとうございます。
>ruby-talkをはじめとして何度も打ち消してると思います。
おお、それは知りませんでした。失礼しました。
コメント前に「PoLS Ruby」「Ruby principle of least surprise」でGoogle検索してみましたが、かなり根強く広まった原則になっていますね…… Wikipediaとか。
もっとすごい事に「驚き最少」で検索すると2002年のスライドしか引っかからない。
広まってますねえ。たとえばcomp.lang.ruby FAQ 2.6を参照してください。
http://rubyhacker.com/clrFAQ.html
あと、「Principle of Matz's Least Surprise」と言われることもあります。
こっちは打ち消してません。だって事実だもの。