Project

General

Profile

Feature #15575

Prohibit to pass a block singleton class

Added by ko1 (Koichi Sasada) over 1 year ago. Updated over 1 year ago.

Status:
Closed
Priority:
Normal
Target version:
-
[ruby-core:91333]

Description

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.

Also available in: Atom PDF