Project

General

Profile

Actions

Bug #19548

closed

Ambiguous and confusing syntax for alias/undef arguments

Added by hurricup (Alexandr Evstigneev) over 1 year ago. Updated over 1 year ago.

Status:
Rejected
Assignee:
-
Target version:
-
[ruby-core:113022]

Description

This was introduced in https://bugs.ruby-lang.org/issues/8851 and looks really confusing at least because of bare /.
Here are 3 semantically similar methods, but feels like first two should not be valid:

def method1
  undef :*,<<,/,[]
  alias :* /
end

def method2
  undef :*,
    <<,
    /,
    []
  alias :*
  /
end

def method3
  undef :*
  undef :<<
  undef :/
  undef :[]
  alias :* :/
end

puts RubyVM::InstructionSequence.of(method :method1).disasm
puts RubyVM::InstructionSequence.of(method :method2).disasm
puts RubyVM::InstructionSequence.of(method :method3).disasm
Actions

Also available in: Atom PDF

Like0
Like0