[phobos] enforce() vs. assert() for range primitives

David Simcha dsimcha at gmail.com
Thu Aug 19 21:47:26 PDT 2010

On 8/20/2010 12:39 AM, Steven Schveighoffer wrote:
> This is only true for instantiations that aren't invoked in the std lib. Any future instantiations that match ones in the std lib will use the version compiled into Phobos. It makes for very inconsistent results. I personally think that until enforce doesn't prevent inlining it should not be used anywhere in ranges since much of the range concept's charter is for inlining performance advantages.

And ranges will likely never stop affecting inlining.  It's not just a 
DMD optimizer sucking issue.  It's also the amount of code an enforce() 
call generates.  Read the disassembly to one and you'll see what I'm 
talking about.

More information about the phobos mailing list