Against enforce()

Adam D. Ruppe destructionator at gmail.com
Wed Mar 16 19:04:00 PDT 2011


Daniel Gibson
>    enforce(foo, new BlaException("bad!"));

One use of enforce is something more like this:

auto fp = enforce(fopen("my file", "r"), "cant open file");

Which replaces:

auto fp = fopen("my file", "r");
if(fp is null) throw new Exception("cant open file");


More information about the Digitalmars-d mailing list