[#50354] 2.5.0で追加されたTime#atの引数について — Satoru Sakashita <sakasita@...>
坂下です。
8 messages
2017/12/16
[#50356] Re: 2.5.0で追加されたTime#atの引数について
— "Urabe, Shyouhei" <shyouhei@...>
2017/12/17
msecだとミリ秒かマイクロ秒か区別がつかないです。もっと良い名前があれば採用されるんじゃないでしょうか。
[#50357] Re: 2.5.0で追加されたTime#atの引数について
— Naotoshi Seo <sonots@...>
2017/12/18
横からすみません。一般的に mili second は ms、micro second は us と省略するので msec でも良いような気がします。
[#50394] [Ruby trunk Bug#14240] warn four special variables: $; $, $/ $\ — matz@...
Issue #14240 has been updated by matz (Yukihiro Matsumoto).
4 messages
2017/12/26
[#50396] Re: [Ruby trunk Bug#14240] warn four special variables: $; $, $/ $\
— Eric Wong <normalperson@...>
2017/12/26
Shouldn't English posts be on ruby-core instead of ruby-dev?
[ruby-dev:50384] [Ruby trunk Feature#14223] Refinements で定義した #to_proc が &hoge 時に呼ばれないのを緩和する提案
From:
manga.osyo@...
Date:
2017-12-22 16:46:07 UTC
List:
ruby-dev #50384
Issue #14223 has been reported by osyo (manga osyo).
----------------------------------------
Feature #14223: Refinements で定義した #to_proc が &hoge 時に呼ばれないのを緩和する提案
https://bugs.ruby-lang.org/issues/14223
* Author: osyo (manga osyo)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
----------------------------------------
Refinements に関する提案です。
現行の仕様では Refinements で定義された `#to_proc` は `&hoge` 時に暗黙的に呼びだされません。
```ruby
class X
end
using Module.new {
refine String do
def to_proc
proc { |it| it.send self }
end
def refine_method
"X#refine_method"
end
end
}
def func &block
end
p "upcase".refine_method
# => "X#refine_method"
p "upcase".to_proc.call "homu"
# => "HOMU"
# Error: wrong argument type X (expected Proc) (TypeError)
func &"upcase"
```
実行結果:https://wandbox.org/permlink/sbvsCeXwXzwp1WxA
最近の傾向として `Kernel#send` や式展開時の `#to_s` などで Refinements が有効になっています。
そういう意味では `&hoge` で暗黙的に呼び出される `#to_proc` も Refinements が有効になってもよいのではないでしょうか。
この件に関して、他の方の意見を聞かせていただけると助かります。
また、自分で実装を書いてみたのですが『とりあえず動いている』というレベルなので、Refinements の実装に詳しい方がいればパッチもみていただけると助かります。
---Files--------------------------------
refinemetns_to_proc.patch (3.73 KB)
--
https://bugs.ruby-lang.org/