< :前の番号
^ :番号順リスト
> :次の番号
P :前の記事(スレッド移動)
N :次の記事(スレッド移動)
|<:前のスレッド
>|:次のスレッド
^ :返事先
_:自分への返事
>:同じ返事先を持つ記事(前)
<:同じ返事先を持つ記事(後)
---:分割してスレッド表示、再表示
| :分割して(縦)スレッド表示、再表示
~ :スレッドのフレーム消去
.:インデックス
..:インデックスのインデックス
Issue #11604 has been updated by Nobuyoshi Nakada.
Status changed from Feedback to Rejected
Yes, it's your bug.
----------------------------------------
Bug #11604: Ruby's interpreting hash symbol keys as parts of Ruby syntax
https://bugs.ruby-lang.org/issues/11604#change-54529
* Author: Maciej Mensfeld
* Status: Rejected
* Priority: Normal
* Assignee: Yukihiro Matsumoto
* ruby -v: ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-linux]
* Backport:
----------------------------------------
Cannot initialize hashes with some Ruby reserved keywords like: while, until, if, unless, do. Can with other like class, end, elsif, super. Don't really get why
~~~
{ while: 1 } # Will fail
# error.rb:3: syntax error, unexpected ':'
# print { while: 1 }
~~~
However when assigned, works perfectly
~~~
hash = { while: 1 }
~~~
But when used as a method argument - fails
~~~
run(for: 1)
run { for: 1 }
~~~
Works with old syntax
~~~
{ :if => 1 }
~~~
And with new but with quotation marks
~~~
{ 'if': 1 }
~~~
Example file included. Please just execute like this:
~~~
ruby error.rb
~~~
---Files--------------------------------
error.rb (278 Bytes)
--
https://bugs.ruby-lang.org/