Bug #19882
closed
Added by mame (Yusuke Endoh) over 1 year ago.
Updated over 1 year ago.
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.
I think it is rejected at the moment:
-e:1: identifier $0x is not valid to get
-e: compile error (SyntaxError)
Don't overlook the colon!
- Related to Bug #19549: Inconsistency in backref parsing added
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.
- Status changed from Open to Closed
Also available in: Atom
PDF
Like0
Like0Like0Like0Like0Like0Like0