[#38020] irb で %W(#{...}) — yoshihisa masuda <sacong@...>
マスダといいます。
[#38036] undef variable — hirocy <hirocy@...>
hirocyです.
[#38039] proc method — "K.Sasada" <ko1@...>
こんにちは。ささだです。
[#38056] ファイル書換え? — 中村文建 <tx6f-nkmr@...>
初めまして、MLに参加させて頂く中村と申します。
[#38057] [ANN] Ruby-GNOME2-0.6.0 — Masao Mutoh <mutoh@...>
むとうです。
[#38059] [ANN] rbbr-0.3.0 — Masao Mutoh <mutoh@...>
むとうです。
[#38073] module extendable? — Takeshi Horinouchi <horinout@...>
堀之内と申します。
[#38080] ポートが閉じているときの例外など — Mitsuru Ogino <ogino@...>
荻野と申します。いつも質問や要望ばかりですみません。
なかだです。
いわおかです。
荻野です。
なかだです。
いわおかです。
In message <20030812150516.GV37221@barber.fe.rn.tuat.ac.jp>
中川と申します。
In message <20030814.140757.707824131.tetsuo@sapphire.siz.nes.nec.co.jp>
なかだです。
In message <200308160517.h7G5HcPL012839@sharui.nakada.kanuma.tochigi.jp>
なかだです。
In message <200308180959.h7I9xnb7001977@sharui.nakada.kanuma.tochigi.jp>
[#38090] ruby-1.8 で eruby が SEGV — Kazuhiko <kazuhiko@...>
かずひこです。
[#38104] XMLRPC::ModRubyServer — OHARA Shigeki <os@...>
大原です。
[#38122] ruby-tcpwrap and mkmf.rb — Takahiro Kambe <taca@...>
こんにちは。
At Sat, 16 Aug 2003 12:51:55 +0900,
In message <200308160518.h7G5IXPL012842@sharui.nakada.kanuma.tochigi.jp>
なかだです。
In message <200308160714.h7G7ErPL014647@sharui.nakada.kanuma.tochigi.jp>
前田です。
In message <87d6f3znlc.wl@kirk.priv.netlab.jp>
前田です。
わたなべです。
[#38164] Ruby1.8.0でRuby-PostgreSQLがビルドできない — kensaku Maki <sakaki@...>
はじめまして、まきと申します。
[#38183] String << の動作につきまして — kuto@...
うと と申します。
たけ(tk)です。
ふなばです。
たけ(tk)です。
ふなばです。
たけ(tk)です。
ふなばです。
ども、西啓一朗@Ktouth Brand. です。
ふなばです。
ども、西啓一朗@Ktouth Brand. です。
[#38195] 理解の進め方(Re: String << の動作につきまして) — Tadashi Oh-Ya <toy@...>
おおやです。
たけ(tk)です。
たけ(tk)です
In "[ruby-list:38206] 理解の進め方:シュールな世界"
[#38198] Tmailで送るメールに日付がつけられなくなりました — 川田誠司 <kawada.seiji@...>
はじめまして
青木です。
[#38256] かみ砕いた説明をすべき範囲 — 西 啓一朗 <receiver@...>
ども。西啓一朗@Ktouth Brand. です。
なかだです。
たけ(tk)です
なかだです。
たけ(tk)です
いわおかです。
たけ(tk)です
まつもと ゆきひろです
たけ(tk)です。
たけ(tk)です。
[ruby-list:38041] Re: proc method
新井です。
In message "[ruby-list:38039] proc method"
on 06 Aug 2003 21:29:53 +0900,
"K.Sasada" <ko1@namikilab.tuat.ac.jp> wrote:
> こんにちは。ささだです。
>
> proc 組込み関数を、ブロック指定なしで使うと警告が出ます。
>
> ブロックをつけずに使うと、呼び出し元のメソッドで指定されたブロックを
> 手続きオブジェクトとして返すという機能は推奨されなくなったんでしょうか。
あまり警告が適切じゃないのかもしれません。この文脈では proc
でも問題ありません。(ちなみに、Proc.new.call とすると警告は
出ませんが、ブロックで break とすると例外があがります)
doc/NEWS には以下のようにあります。
| : lambda and proc
|
| Proc object returns from these methods has the following attributes:
|
| * strict argument number check
| * break and return terminates the proc execution.
[ruby-dev:20358] には以下のようにかかれてます。
> * Proc.newおよびブロック引数で与えられるProcは、引数チェッ
> クがゆるい。breakやnextが例外になる
> * lambdaおよびprocが返すProcは、引数チェックが厳しい。
> breakやnextは実行の中断
しかし、全然気が付かなかったのですが proc, Proc.new, yield
でそれぞれ違う挙動なのはちょっと問題かも知れません。
# break できるが、引数のあつかいが厳しい
def test
proc.call(1,2,3)
end
test{|a,b| p a; break}
=> -:2: wrong # of arguments (3 for 2) (ArgumentError)
from -:4:in `call'
from -:2:in `test'
from -:4
ruby 1.6.8 (2002-12-24) [i586-linux]
=> -:2: warning: tried to create Proc object without a block
-:4: wrong number of arguments (3 for 2) (ArgumentError)
from -:4:in `call'
from -:2:in `test'
from -:4
ruby 1.8.0 (2003-08-04) [i586-linux]
# 引数のあつかいがゆるい
# break できない
def test
Proc.new.call(1,2,3)
end
test{|a,b| p a; break}
=> -:2: wrong # of arguments (3 for 2) (ArgumentError)
from -:4:in `call'
from -:2:in `test'
from -:4
ruby 1.6.8 (2002-12-24) [i586-linux]
=> ruby 1.8.0 (2003-08-04) [i586-linux]
1
-:2:in `test': unexpected break (LocalJumpError)
from -:4
# すべてにおいてゆるい
def test
yield 1,2,3
end
test{|a,b| p a; break}
=> ruby 1.6.8 (2002-12-24) [i586-linux]
1
=> ruby 1.8.0 (2003-08-04) [i586-linux]
1
--
新井康司 (Koji Arai)