David B. Held wrote:
> Obviously there's a thousand ways to riff on that basic idea, but try
> writing this function in D. As you can see, it's essentially a form of
> assert().
Done:
T Enforce(T)(T p, lazy char[] msg)
{
if (!p)
throw new Exception(msg());
return p;
}
http://www.digitalmars.com/d/1.0/lazy-evaluation.html