Overloading Lazy Vs. Non-Lazy

Tomek Sowiński just at ask.me
Wed Aug 11 15:10:53 PDT 2010


Steven Schveighoffer napisał:

> Hold on, can't we have enforce and lenforce (lazy enforce)?
> 
> From a simple grep, 99% of enforce instances are:
> 
> enforce(condition)
> -or-
> enforce(condition, "compile-time-string")
> -or-
> enforce(condition, "compile-time-string" ~ type.stringof)
> 
> There are a few ones which actually would be allocating strings at
> runtime, but seriously, can't we just modify those to lenforce and get
> inlining everywhere else?  I think phobos would see both a huge speedup
> and a smaller footprint immediately if enforce did not take a lazy arg.

I like this idea. But > 1 option makes you think and that's painful;)
BTW, am I the only person surprised that in a language whose generic code to fit the need can transform like Optimus Prime himself you 
can't do lazy <-> non-lazy automagically?


Tomek


More information about the Digitalmars-d mailing list