[ruby-core:101984] [Ruby master Bug#17520] Allow symbols starting with number, e.g. :2_weeks
From:
dorian@...
Date:
2021-01-08 21:59:04 UTC
List:
ruby-core #101984
Issue #17520 has been reported by dorianmariefr (Dorian Mari薊.
----------------------------------------
Bug #17520: Allow symbols starting with number, e.g. :2_weeks
https://bugs.ruby-lang.org/issues/17520
* Author: dorianmariefr (Dorian Mari薊
* Status: Open
* Priority: Normal
* ruby -v: ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-darwin19]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
For instance:
```
p({ 2_weeks: 1 })
```
results in:
```
a.rb:1: trailing `_' in number
p({ 2_weeks: 1 })
a.rb:1: syntax error, unexpected local variable or method, expecting =>
p({ 2_weeks: 1 })
```
and
```
p({ :2_weeks => 1 })
```
results in:
```
a.rb:1: trailing `_' in number
p({ :2_weeks => 1 })
a.rb:1: syntax error, unexpected integer literal, expecting literal content or terminator or tSTRING_DBEG or tSTRING_DVAR
```
I'm not sure if it's doable as ruby thinks I'm writing a number, just wondering if that could be possible to start a symbol with a number
--
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>