Overloading Lazy Vs. Non-Lazy
Pillsy
pillsbury at gmail.com
Thu Aug 12 09:06:45 PDT 2010
Steven Schveighoffer Wrote:
[...]
> Hold on, can't we have enforce and lenforce (lazy enforce)?
Or couldn't we have an overload for enforce that takes a string, and another overload that takes a void delegate returning a string?
It makes the syntax a little grottier, but...
> 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)
...if you have to write
enforce(condition,
(){ return "compile-time-string" ~ type.stringof; });
one time in a hundred, is it really that bad?
Cheers,
Pillsy
More information about the Digitalmars-d
mailing list