Would something like this make sense?
mymeth(myargs) rescue { puts “mymeth failed”; exit }
It’s not current syntax. I’m asking whether
it would make sense to add it.
Hal
···
–
Hal Fulton
hal9000@hypermetrics.com
Would something like this make sense?
mymeth(myargs) rescue { puts “mymeth failed”; exit }
It’s not current syntax. I’m asking whether
it would make sense to add it.
Hal
–
Hal Fulton
hal9000@hypermetrics.com
Hal E. Fulton wrote:
Would something like this make sense?
mymeth(myargs) rescue { puts “mymeth failed”; exit }
It’s not current syntax. I’m asking whether
it would make sense to add it.
Not really an answer to your question, but there is this:
def boom
raise
end
boom rescue begin
puts “boom failed”
exit
end
puts “Darn, it didn’t work”
It works, needless to say. Actually I’ve always been a bit uncomfortable
with using begin/end for this and for “begin…end while …”. It seems
like do…end and {…} should be doing that job, and begin…end should
be just for exceptions. But I don’t lose sleep over it.
I thought rescue modifier was for the current line.
Isn’t there a conflict when there’s a rescue in the
method def ?
def mymeth(args)
MATH::PI / args
#rescue # ← uncomment & re-run
puts “Do you mean; insert/replace me ?”
end
mymeth(0) rescue begin
puts “This line failed 1”
end
mymeth(undefined) rescue begin
puts “This line failed 2”
end
2 pence,
daz
“Hal E. Fulton” hal9000@hypermetrics.com wrote:
Would something like this make sense?
mymeth(myargs) rescue { puts “mymeth failed”; exit }
It’s not current syntax. I’m asking whether
it would make sense to add it.Hal
–
Hal Fulton
hal9000@hypermetrics.com