Re: Crash or return forbidden value?

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

My take on this is that it is entirely context-dependent, since Euphoria does
not have an exception system and is unlikely to get one any time soon.

Some cases, such as has been mentioned with open() either create a new file or
return with -1 which is known to be an invalid file handle. Other
functions/procedures should return error values if it makes sense to do so and if
it is possible (that is, there is an error value that is recognized as such and
not as a valid return value).

For functions and procedures that will definitely crash given erroneous input,
it is the responsibility of the programmer to validate the input before calling
the function/procedure.

Basically, status quo ante. Unless and until some form of exception system has
been designed.

--
A complex system that works is invariably found to have evolved from a simple
system that works.
--John Gall's 15th law of Systemantics.

"Premature optimization is the root of all evil in programming."
--C.A.R. Hoare

j.

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

Search



Quick Links

User menu

Not signed in.

Misc Menu