|
|
|
|
|
by zenspider
6497 days ago
|
|
foo = returning(Object.new) do |f|
def f.bar
...
end
def f.bash
...
end
end
# vs
foo = Object.new
def foo.bar
...
end
def foo.bash
...
end
1 line shorter, less indentation, more clear. What does returning get you besides another message send and block activation? I have yet to see a good use for it. (yes, I'm biased. calibrate accordingly) |
|
For the same reason, I write:
When teh two statements are independant, and: When they are deeply related and should not be broken up. Sometimes that is hard to read and I will get gratuitous: What can I say... that uses more characters than needed. It isn't always about saving electrons for me.