[#87467] [Ruby trunk Bug#14841] Very rarely IO#readpartial does not raise EOFError — mofezilla@...
Issue #14841 has been reported by hirura (Hiroyuki URANISHI).
3 messages
2018/06/10
[#87515] [Ruby trunk Bug#14841] Very rarely IO#readpartial does not raise EOFError — hirura@...
Issue #14841 has been updated by hirura (Hiroyuki URANISHI).
7 messages
2018/06/19
[#87516] Re: [Ruby trunk Bug#14841] Very rarely IO#readpartial does not raise EOFError
— Eric Wong <normalperson@...>
2018/06/19
hirura@gmail.com wrote:
[#87517] Re: [Ruby trunk Bug#14841] Very rarely IO#readpartial does not raise EOFError
— Eric Wong <normalperson@...>
2018/06/19
Sorry, I left this out: If you can reproduce it again, can you
[#87519] Re: [Ruby trunk Bug#14841] Very rarely IO#readpartial does not raise EOFError
— hirura <hirura@...>
2018/06/19
Hi Eric,
[#87521] Re: [Ruby trunk Bug#14841] Very rarely IO#readpartial does not raise EOFError
— Eric Wong <normalperson@...>
2018/06/19
hirura <hirura@gmail.com> wrote:
[#87541] [Ruby trunk Feature#14859] [PATCH] implement Timeout in VM — normalperson@...
Issue #14859 has been reported by normalperson (Eric Wong).
4 messages
2018/06/21
[#87605] [Ruby trunk Bug#14867] Process.wait can wait for MJIT compiler process — takashikkbn@...
Issue #14867 has been reported by k0kubun (Takashi Kokubun).
3 messages
2018/06/23
[#87614] [Ruby trunk Bug#14867] Process.wait can wait for MJIT compiler process — normalperson@...
Issue #14867 has been updated by normalperson (Eric Wong).
4 messages
2018/06/23
[#87631] [Ruby trunk Bug#14867] Process.wait can wait for MJIT compiler process — takashikkbn@...
Issue #14867 has been updated by k0kubun (Takashi Kokubun).
5 messages
2018/06/25
[#87635] Re: [Ruby trunk Bug#14867] Process.wait can wait for MJIT compiler process
— Eric Wong <normalperson@...>
2018/06/25
takashikkbn@gmail.com wrote:
[#87665] [Ruby trunk Bug#14867] Process.wait can wait for MJIT compiler process — eregontp@...
Issue #14867 has been updated by Eregon (Benoit Daloze).
4 messages
2018/06/28
[#87710] [Ruby trunk Bug#14867] Process.wait can wait for MJIT compiler process — Greg.mpls@...
Issue #14867 has been updated by MSP-Greg (Greg L).
3 messages
2018/06/30
[ruby-core:87634] [Ruby trunk Feature#14111] ArgumentErrorが発生した時メソッドのプロトタイプをメッセージに含む
From:
ewfawefw3@...
Date:
2018-06-25 21:10:15 UTC
List:
ruby-core #87634
Issue #14111 has been updated by esjee (SJ Stoker).
File argument_error.rb added
返事ありがとうございます。https://github.com/nobu/ruby/tree/feature/14111-ArgumentError-attributesのパッチで大体の問題は解決されるようです。
今まだ苦戦してるところはこういうメソッド:
```
def foo(a, b = 3); end
```
を理想の
```
Method prototype:
def foo1(a, b = 3)
```
にすることです。
nobuさんが前に挙がった`Method#parameters`を使うとデフォルト値の方は含まれてません。
デフォルト値がもうすこし複雑だったらこれを表示する方法は難しいのではないかと思います。
例えば、こういうメソッドがあったら:
```
def foo(a, b = (->() { Time.now.to_i }).call)
def bar(a, b = (->() { $count ||= 0; $count += 1}).call)
```
`b`のデフォル値を表示することは難儀になると思います。
nobuさんのパッチを使ったら、こういうメッセージを発生することは出来るようになります:
```
$ cat kerk.rb
class Foo
def bar(a, b, c = 3, *all_the_args, d:, e: 7)
end
end
Foo.new.bar
$ ./ruby kerk.rb
Traceback (most recent call last):
1: from kerk.rb:6:in `<main>'
/home/esjee/src/ruby/kerk.rb:2:in `bar': wrong number of arguments (given 0, expected 2+; required keyword: d) (ArgumentError)
Method parameters:
a (required)
b (required)
c (optional)
all_the_args (rest)
d (required keyword)
e (optional keyword)
```
できればデフォル値も含みたいのですが、今のところそれを可能するいいアイデアはありません。
nobuさんのパッチをrubyに入れることでgemでこういうメッセージを発生することが可能になるので、まずはそれで進みたいと思います。
ちなみに、興味があれば、添付したrbファイルはnobuさんのパッチを使って、上のメッセージを作られるパッチです。
----------------------------------------
Feature #14111: ArgumentErrorが発生した時メソッドのプロトタイプをメッセージに含む
https://bugs.ruby-lang.org/issues/14111#change-72655
* Author: esjee (SJ Stoker)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
----------------------------------------
(日本人じゃないですが、日本語を勉強してますから、日本語でレポートしてみました
日本語で会話することはまだ馴れてないから、読みつらいや見苦しいところもあると思います
そういうを指摘してくれれば幸いです)
# Abstract
ArgumentErrorが発生したときのメッセージをより有意義にするため、コールしたメソッドのプロトタイプを表示することを提案したいと思います
# Background
今ではArgumentErrorが発生するとこんな感じです
```
[1] pry(main)> cat ./spec/kerk_class.rb
class Kerk
def foo1(a)
end
end
[2] pry(main)> require './spec/kerk_class.rb'
=> true
[3] pry(main)> Kerk.new.foo1
ArgumentError: wrong number of arguments (0 for 1)
from /home/esjee/src/printprototype/spec/kerk_class.rb:2:in `foo1'
```
簡単なメソッドやよく使うメソッドではこれでも問題ありません
しかし、他の人のコードとか、あまり使わないメソッドだとこのメソッドのソースを読まないと分からないこともある
Rubyのメソッドだとマニュアルを参照するしかないかもしれない
# Proposal
ArgumentErrorのメッセージにコールしたメソッドのプロトタイプを含む
例えば
```
[4] pry(main)> Kerk.new.foo1
ArgumentError: wrong number of arguments (0 for 1)
Method prototype:
def foo1(a)
from /home/esjee/src/printprototype/spec/kerk_class.rb:2:in `foo1'
```
# Implementation
https://github.com/esjee/PrintPrototype
とくにこのファイル
https://github.com/esjee/PrintPrototype/blob/master/lib/printprototype/core_ext/argument_error.rb
# Evaluation
ですけど、この実装には複数の問題があります
* 複数のラインで書かれたメソッドのプロトタイプはどうやって見つければ?
* 全ファイルを読み込んでるため、巨大なファイルだとパフォーマンスに問題があるかもしれない
* Ruby自身のメソッドではrbファイルが見つからないため、表示できない
* sentry-ravenに頼ってはいけないでしょう
# Discussion
これまで読んでいただいて、ありがとうございました
私から二つの質問があります
* これはよいfeatureだと思いますか?
* 上で挙げられた複数な問題をどうやって乗り越えられるでしょうか?
# Summary
ArgumentErrorが発生した時にもっと有意義なメッセージを表示したいと思います
私はこれをgemにしようと思いましたが、満足のできる実装にはできませんでした
小さくても、これはRubyを改良するfeatueだと信じてるです
皆さんの意見と助けを求め、これを書きました
---Files--------------------------------
add_receiver_and_method_name_to_argument_error_for_application_code.diff (4.5 KB)
add_receiver_and_method_name_to_argument_error_for_application_code_2.diff (8.51 KB)
argument_error.rb (897 Bytes)
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>