From: jacknagel@... Date: 2015-02-19T23:57:00+00:00 Subject: [ruby-core:68194] [Ruby trunk - Bug #10870] Hash Literal Declined As First Argument Issue #10870 has been updated by Jack Nagel. `foo {}` without parentheses is equivalent to `foo() {}`, (i.e. passing a block to `foo`) not `foo({})`. ---------------------------------------- Bug #10870: Hash Literal Declined As First Argument https://bugs.ruby-lang.org/issues/10870#change-51564 * Author: Imran "" * Status: Open * Priority: Normal * Assignee: * ruby -v: 2.0.0-p481 * Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN ---------------------------------------- Hi, When a hash literal is passed as first argument to a method, Ruby throws a syntax error. Example code: ~~~ruby def foo *args p args end foo 'Hello' foo 123 foo ['Hello', 123] foo {:hello => 123} # Syntax Error: Unexpected => Expecting } ~~~ However, shifting hash literal over to second place, somehow makes it all legal. ~~~ruby foo 'Unnecessary 1st Argument', {:hello => 123} # Error gone ~~~ Cheers. -- https://bugs.ruby-lang.org/