[ruby-core:96333] [Ruby master Feature#16433] Proposal: Output warning if `_1` is used in parameter name

From: manga.osyo@...
Date: 2019-12-19 13:27:29 UTC
List: ruby-core #96333
Issue #16433 has been reported by osyo (manga osyo).

----------------------------------------
Feature #16433: Proposal: Output warning if `_1` is used in parameter name
https://bugs.ruby-lang.org/issues/16433

* Author: osyo (manga osyo)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
Currently, output warning if local variable name is `_1`.

```ruby
# warning: `_1' is used as numbered parameter
_1 = 42
```

However, if parameter name is `_1`, no output warning is issued.

```ruby
# Actual behavior
# no warning
def hoge(_1);
end
```

If local variable `_1` causes a syntax error in Ruby 3.0(or later ?), I think it is better to output a warning even if you use argument name `_1`.

```ruby
# Expected behavior
# warning: `_1' is used as numbered parameter
def hoge(_1);
end
```




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

In This Thread

Prev Next