Review: A new stab at a potential std.unittests
Jonathan M Davis
jmdavisProg at gmx.com
Sun Nov 21 05:56:52 PST 2010
On Sunday 21 November 2010 05:44:15 Jacob Carlborg wrote:
> I don't know if the compiler can inline delegates or not but if it can I
> think this case would be very easy for the compiler to inline the delegate.
It can't. That's one of the big issues with enforce. At the moment, it actually
makes it so that if you use enforce in a function, that function can't be
inlined. Assuming that that gets fixed, assertExcThrown!() might then be
inlineable, depending on how picky the inliner is, at which point perhaps the
delegate could be inlined, but I don't think that delegates will ever be
inlineable unless the function they're called in is inlined, because the
delegate to inline would change every time that the function is called.
In any case, it's definitely true that the compiler may be able to better
optimize assertExcThrown!(). But much as I'd like fast unit testing code, I'd
much rather have useable and readily maintainable unit testing code than fast
unit testing code. It would be nice to have both though.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list