L
Logan Capaldo
This is pure unadulterated evil, however it did come up in #ruby-lang aSometimes i do this:
return x if x
Anyway to code it as:
return_on x
t.
while ago, so I whipped up some good old fashioned homemade evil:
def try_return(&block)
unless (blah = block.call).nil?
GC.disable
eval("return ObjectSpace._id2ref(#{blah.object_id})", block)
end
ensure
GC.enable
end
def f
try_return { nil }
try_return { 7 }
0
end
p f