Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quoted symbols are not accepted as hash keys using new syntax #3231

Closed
dabroz opened this issue Nov 1, 2016 · 4 comments
Closed

Quoted symbols are not accepted as hash keys using new syntax #3231

dabroz opened this issue Nov 1, 2016 · 4 comments

Comments

@dabroz
Copy link
Contributor

@dabroz dabroz commented Nov 1, 2016

Following Ruby code:

puts({'1': 1})

is correctly handled by CRuby (ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]):

{:"1"=>1}

but doesn't work with mruby (latest from master, 9a126278):

./test.rb:1:10: syntax error, unexpected ':', expecting tASSOC

Old syntax ({:'1' => 1}) works correctly in mruby.

@cremno
Copy link
Contributor

@cremno cremno commented Nov 1, 2016

That's a 2.2 feature. mruby targets 1.9 syntax including bug fixes. I don't oppose implementing it though.

@matz
Copy link
Member

@matz matz commented Nov 1, 2016

mruby gradually adopting 2.x features. It's a good chance to add quoted labels.

@matz matz closed this as completed in 13d0832 Nov 1, 2016
@ksss
Copy link
Contributor

@ksss ksss commented Nov 2, 2016

I found this case.

$ mirb
> {"1": 1}
 => {:"1"=>1}
> {'1': 1}
line 2: syntax error, unexpected tLABEL_END, expecting '}'

$ irb
irb(main):001:0> {"1": 1}
=> {:"1"=>1}
irb(main):002:0> {'1': 1}
=> {:"1"=>1}

@ksss
Copy link
Contributor

@ksss ksss commented Nov 3, 2016

Thank you for fixing

matz added a commit that referenced this issue Nov 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants