Project

General

Profile

Actions

Feature #15575

closed

Prohibit to pass a block singleton class

Added by ko1 (Koichi Sasada) almost 6 years ago. Updated almost 6 years ago.

Status:
Closed
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.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0