[ruby-core:113022] [Ruby master Bug#19548] Ambiguous and confusing syntax for alias/undef arguments

Issue #19548 has been reported by hurricup (Alexandr Evstigneev). ---------------------------------------- Bug #19548: Ambiguous and confusing syntax for alias/undef arguments https://bugs.ruby-lang.org/issues/19548 * Author: hurricup (Alexandr Evstigneev) * Status: Open * Priority: Normal * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- 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 ``` -- https://bugs.ruby-lang.org/

Issue #19548 has been updated by jeremyevans0 (Jeremy Evans). Status changed from Open to Rejected This isn't a bug, nor does it appear to be introduced by #8851 (that added support for `%s` symbol literals with `alias`/`undef`, other symbol literals were already supported). `undef` and `alias` have always accepted symbols and bare words, so `alias :* /` and `undef :*, /` work, as do `alias * /` and `undef *, /`. Not allowing bare words would break existing code. ---------------------------------------- Bug #19548: Ambiguous and confusing syntax for alias/undef arguments https://bugs.ruby-lang.org/issues/19548#change-102625 * Author: hurricup (Alexandr Evstigneev) * Status: Rejected * Priority: Normal * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- 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 ``` -- https://bugs.ruby-lang.org/
participants (2)
-
hurricup (Alexandr Evstigneev)
-
jeremyevans0 (Jeremy Evans)