Project

General

Profile

Actions

Bug #5751

closed

functions unable to handle hashes containing spaces unless wrapped in parenthesis

Added by spencerroan@gmail.com (spencer roan) almost 13 years ago. Updated almost 13 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
all
Backport:
[ruby-core:41613]

Description

puts { :a => :b}
SyntaxError: (irb):23: syntax error, unexpected tASSOC, expecting '}'
puts { :a => :b}

puts { a: :b}
SyntaxError: (irb):24: syntax error, unexpected ':', expecting '}'
puts { a: :b}

def foo x
puts x
end
=> nil
foo {:a => :b}
SyntaxError: (irb):28: syntax error, unexpected tASSOC, expecting '}'
foo {:a => :b}

I suspect this is a precedence/binding issue.

Updated by nobu (Nobuyoshi Nakada) almost 13 years ago

  • Status changed from Open to Rejected
  • ruby -v changed from 1.9.2 to all

A brace after method invocation is parsed as a block.

Actions

Also available in: Atom PDF

Like0
Like0