< :前の番号
^ :番号順リスト
> :次の番号
P :前の記事(スレッド移動)
N :次の記事(スレッド移動)
|<:前のスレッド
>|:次のスレッド
^ :返事先
_:自分への返事
>:同じ返事先を持つ記事(前)
<:同じ返事先を持つ記事(後)
---:分割してスレッド表示、再表示
| :分割して(縦)スレッド表示、再表示
~ :スレッドのフレーム消去
.:インデックス
..:インデックスのインデックス
Issue #15575 has been updated by Eregon (Benoit Daloze).
ko1 (Koichi Sasada) wrote:
> or make it syntax sugre of `singleton_class.class_exec do`?
I think that would be confusing as `class` (like `module` and `def`) is a keyword which normally adds a new lexical scope and does not capture the parent local variables.
----------------------------------------
Feature #15575: Prohibit to pass a block singleton class
https://bugs.ruby-lang.org/issues/15575#change-76593
* Author: ko1 (Koichi Sasada)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version:
----------------------------------------
The following code works now:
```
def foo
class << Object.new
yield
end
end
foo{ p :ok } #=> :ok
```
but I think this feature is very strange because local variables are not active in singleton class.
How about to prohibit this feature?
plan: warning at ruby 2.7 and prohibit it in ruby 3.
--
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>