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

Comments

Projects
None yet
4 participants
@dabroz
Contributor

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

This comment has been minimized.

Show comment
Hide comment
@cremno

cremno Nov 1, 2016

Contributor

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

Contributor

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

This comment has been minimized.

Show comment
Hide comment
@matz

matz Nov 1, 2016

Member

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

Member

matz commented Nov 1, 2016

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

@matz matz closed this in 13d0832 Nov 1, 2016

@ksss

This comment has been minimized.

Show comment
Hide comment
@ksss

ksss Nov 2, 2016

Contributor

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}
Contributor

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}

matz added a commit that referenced this issue Nov 2, 2016

@ksss

This comment has been minimized.

Show comment
Hide comment
@ksss

ksss Nov 3, 2016

Contributor

Thank you for fixing

Contributor

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