Actions
Bug #19882
closed:$0x should be rejected
Description
irb(main):001> :$0x
=> :"$0x"
Since $0x
is not a valid global variable name, I think it should be rejected unless quotation marks are used.
Updated by kddnewton (Kevin Newton) 11 months ago
I think it is rejected at the moment:
-e:1: identifier $0x is not valid to get
-e: compile error (SyntaxError)
Updated by mame (Yusuke Endoh) 11 months ago
Don't overlook the colon!
Updated by nobu (Nobuyoshi Nakada) 11 months ago
- Related to Bug #19549: Inconsistency in backref parsing added
Updated by nobu (Nobuyoshi Nakada) 11 months ago
It's subtly intentional.
The former seemed better to me.
$ ruby -e '$01234'
-e:1: identifier $01234 is not valid to get
-e: compile error (SyntaxError)
$ ./ruby -e 'p :$01234'
-e:1: syntax error, unexpected integer literal, expecting end-of-input
$01234
^~~~
-e: compile error (SyntaxError)
"Then the symbol should not be quoted"?, maybe.
Updated by nobu (Nobuyoshi Nakada) 11 months ago
Updated by nobu (Nobuyoshi Nakada) 11 months ago
- Status changed from Open to Closed
Applied in changeset git|89802078f9f406be411032814e1960e62dbc7ce2.
[Bug #19882] Reject tokens invalid as symbols
Actions
Like0
Like0Like0Like0Like0Like0Like0