assert vs. enforce in Phobos code

monarch_dodra monarchdodra at gmail.com
Sun Feb 23 13:11:54 PST 2014


On Sunday, 23 February 2014 at 20:00:48 UTC, Jesse Phillips wrote:
> On Sunday, 23 February 2014 at 17:51:34 UTC, Joseph Rushton 
> Wakeling wrote:
>> Assuming I'm right about these enforce statements being 
>> inappropriate, I'll make a patch.
>
> I believe you are correct, but the larger issue is that Phobos 
> doesn't come with a debug build. So while they probably should 
> be contracts, they will not be verified since the contracts 
> will be compiled out.

It's "less" of an issue with phobos, which massivelly templated. 
Only very few things are non-template (AFAIK).

The bigger issue is things such as druntime, which is basically 
99% pre-compiled.

That, and there's also the broader issue of the conditionality of 
contracts should be decided by the "calling" library.


More information about the Digitalmars-d mailing list