Re: Try/Catch

new topic     » goto parent     » topic index » view thread      » older message » newer message

Hi, Pete.

I appreciate your detailed explanation. I think we're talking about different things, so let me focus on those before muddying the waters:

petelomax said...

Euphoria has always had perfectly good error code handling, by which I mean open() returns -1, get() returns GET_FAIL, or that you can test for divide by zero first.

This is not error handling. open() has a defined behavior of returning a value.

By "error", I mean exactly that: a runtime error, where RTFatal is called, and intentional shutdown of Euphoria is executed.

Consider the following code:

s1[i][j] = s2[j][k] 

If i, j or k is out of range, this is a runtime error in Euphoria.

In a similar vein, the following is not error handling, either:

if i <= length(s1) and j <= length(s1[i]) and j <= length(s2) and k <= length(s2[k]) then 
    s1[i][j] = s2[j][k] 
else 
    -- do something else 
end if 

An "error" happens when code executes and triggers an exception/error.

By "error handling", I mean "take action to recover from a exception, and continue normal execution", not "perform some save routine, and then shut down."

See the use case in my prior post for an explanation why I don't consider shutting down to be a preferred action.

petelomax said...

cleanup(handle), or as below

I'm not sure what cleanup is defined as doing. Is this something you're proposing, or is already in Euphoria?

- David

PS: I just use italics for emphasis, not irritation. smile

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu