Actions
Bug #1017
closedCurly braces {...} and do ... end
Description
=begin
I gather that curly braces and do..end are supposed to work the same, why then is this ok
def save_block name, &b
@blocks ||= {}
@blocks[name] = b
end
save_block :say_hello do
puts "hello!"
end
but not this:
save_block :say_hello {
puts "hello!"
}
#ruby 1.9.1p5000 (2009-01-13 trunk 21497) [i386-darwin9.6.0]
=end
Updated by austin (Austin Ziegler) over 16 years ago
=begin
They aren't actually supposed to work the same. do/end and {/} differ in binding precedence. Your code is the equivalent of:
save_block(:say_hello) do
puts "hello!"
end
save_block(:say_hello {
puts "hello!"
})
That's the difference between the two types of block delimiters. Not new, not a bug.
=end
Updated by shyouhei (Shyouhei Urabe) over 16 years ago
- Status changed from Open to Rejected
=begin
=end
Actions
Like0
Like0Like0