On 18-May-2015 17:18, Steven Schveighoffer wrote:
On 5/18/15 8:20 AM, Atila Neves wrote:
One thing I like about `enforce` is that the program's run-time checks
become positive instead of negative statements which I think is a lot
more readable. i.e.

     enforce(foo && bar > 4, "...");

instead of

    if(!foo || bar <=3) throw new Exception("...");

Yes, but that's a minor nuisance. I often do not rewrite conditions by
distributing the negation to avoid this problem. In that case, the
"operation" becomes basically:

if(!(...))

We could introduce a new 'when' keyword:


Perl's unless would "solve" this nicely ;)


--
Dmitry Olshansky

Reply via email to