Re: error codes in returns
- Posted by euphoric (admin) Sep 11, 2009
- 1345 views
The day Eu contains the missing stuff its simplicity is gone too.
I think simplicity gets confused with ease-of-use. Euphoria is not simple, but it is easy to use. Good for beginners, good for professionals.
We could add something complex to Euphoria and not take away from its base ease-of-use.
IOW, if we add exceptions, that doesn't make Euphoria any less easy-to-use by the fact that the user doesn't need to use exceptions. It does add complexity for when it's desired, but that just makes Euphoria more powerful.
I have a system where I return a two-element sequence from functions, { SUCCESS_CODE, RESULT }, where SUCCESS_CODE is a boolean representing the success or fail of the function, and RESULT is the error message if it failed, or actual result of the function if successful. I don't know that this is any better than the current almost-standard method of returning an atom upon fail. I think somebody convinced me it's not. But I've used it successfully for a while.