<br><br><div class="gmail_quote">On Fri, Jun 7, 2013 at 11:41 PM, Jonathan M Davis <span dir="ltr"><<a href="mailto:jmdavisProg@gmx.com" target="_blank">jmdavisProg@gmx.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Friday, June 07, 2013 23:23:25 Timothee Cour wrote:<br>
> Why can't we detect at compile time module ctor/dtor cycles (instead of<br>
> runtime) ?<br>
<br>
</div>At minimum, separate compilation stops it. A .di file isn't likely to have them<br>
even if its corresponding .d file did.</blockquote><div><br></div><div>automatically generated di files (eg -Hffilename) *do* generate static this();</div><div>All we need is to run an extra test at compile time to test for this. The might accept invalid code (as is already the case, delaying error to runtime; ie false positive), but will have no false negatives (if a cycle is detected at CT, it can safely reject the code as runtime test will also find the cycle). I'd further argue that in large majority of cases there should be no false positives, due to auto generated di files generating static this();</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> IIRC, there were other reasons as well, but I don't remember them at the moment.<br></blockquote><div>
<br></div><div>so I guess it would only depend on those 'other reasons'. Does anyone have an idea what those could be?</div><div><br></div></div>