Re: Try/Catch

new topic     » goto parent     » topic index » view thread      » older message » newer message
jaygade said...

I prefer Go's handling of errors compared to exceptions as performed in other languages.

This looks roughly akin to BASIC - On Error Continue, where an Err value is set, but the code doesn't fail. The main difference seems to be that Go returns an Error object, while BASIC has a global value.

However, in Euphoria, there's no such thing as a recoverable error. So in that sense, it's sort of the opposite of how Euphoria handles errors: Euphoria halts, while Go continues, but informs you that an error occurred.

From that perspective, I think it would be a hard sell. That is, it fundamentally alters how Euphoria behaves. On the other hand, try/catch/finally wouldn't actually alter Euphoria's behavior - if you chose not to use them, exceptions would still be fatal.

jaygade said...

For cleaning up resources, Go has "defer" which defers the execution of a piece of code until the subroutine exits.

This seems akin to finally. The main difference is that is that finally can be embedded inside of other try/catch loops.

- David

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

Search



Quick Links

User menu

Not signed in.

Misc Menu