K
klochner
I couldn't find any meaty discussions on this topic, so maybe it's
worth a post.
Does it make sense to use yield at the end of a function, where you're
essentially
using yield to replace a return value? For example:
def returnfoo
return foo
end
vs.
def yieldfoo
yield foo
end
I see a lot of ruby programmers doing the latter, but consider the
former to
be more straightforward. There are a lot of cases where yielding is
more elegant
than return, but I don't consider this to be one of them. Anyone care
to weigh in?
worth a post.
Does it make sense to use yield at the end of a function, where you're
essentially
using yield to replace a return value? For example:
def returnfoo
return foo
end
vs.
def yieldfoo
yield foo
end
I see a lot of ruby programmers doing the latter, but consider the
former to
be more straightforward. There are a lot of cases where yielding is
more elegant
than return, but I don't consider this to be one of them. Anyone care
to weigh in?