On 3/17/11, Adam D. Ruppe <destructiona...@gmail.com> wrote:
> 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");
>

Well that is pretty sweet. I didn't know enforce returned the type
back. Time to cut some lines in my code, yay.

Reply via email to