assume, assert, enforce, @safe

Sean Kelly via Digitalmars-d digitalmars-d at puremagic.com
Thu Jul 31 13:52:29 PDT 2014


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?


More information about the Digitalmars-d mailing list