On Thursday, 31 July 2014 at 20:52:30 UTC, Sean Kelly wrote:
On Wednesday, 30 July 2014 at 22:01:23 UTC, Walter Bright wrote:
3. Use of assert to validate input is utterly wrong and will
not be supported. Use such constructs at your own risk.
...
6. enforce() is meant to check for input errors (environmental
errors are considered input).
7. using enforce() to check for program bugs is utterly wrong.
enforce() is a library creation, the core language does not
recognize it.
Could you expand on what you consider input? For example, if a
function has an "in" contract that validates input parameters,
is
the determination that a parameter is invalid a program bug or
simply invalid input? If you consider this invalid input that
should be checked by enforce(), can you explain why?
This also puzzles me. There is the point where the two types of
errors blend to the point of being uncomfortable.
Eg: a program generates files in X format and can also read them
with a X parser. Its X parser will only ever read output
generated by itself. Should input errors in X parser be checked
with assert or exceptions?