Project

General

Profile

Actions

Feature #17520

open

Allow symbols starting with number, e.g. :2_weeks

Added by dorianmariefr (Dorian Marié) 9 months ago. Updated 8 months ago.

Status:
Feedback
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:101984]

Description

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

(I know { "2_weeks": 1 } works, that's what I'm using instead)

Actions

Also available in: Atom PDF