Issue #15575 has been updated by ko1 (Koichi Sasada).


Matz, Thank you for confirmation.

I add a warning (without -w) like that:

```ruby
def foo
  class << Object.new
    yield
  end
end

foo{ p :ok } #=> :ok
```
```
test.rb: warning: `yield' in class syntax will not be supported from Ruby 3.0. [Feature #15575]

```

English correction is wlecome :)


----------------------------------------
Feature #15575: Prohibit to pass a block singleton class
https://bugs.ruby-lang.org/issues/15575#change-76646

* 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>