On Tue, Jun 18, 2013 at 6:01 AM, Steven Schveighoffer <schvei...@yahoo.com>wrote:
> On Mon, 17 Jun 2013 21:19:57 -0400, Timothee Cour < > thelastmamm...@gmail.com> wrote: > > I understand your point, however I argued above that we should run a test >> at compile time to detect cycles. It won't catch all cycles (because of >> certain di files), but it will catch most of them (at least all of the >> ones >> not involving di files). This would be especially handy for people using >> rdmd. >> At runtime, we will also run the test to catch all cases. >> > > rdmd could, as an extra step, generate a program that simply exits with 0, > to check all cycles. Then run that as part of compilation step. > > There isn't a whole lot of difference between checking at compile time and > checking at runtime before main starts. > > there is: when the binary is created but meant to be run at a later time. Eg: building a system that requires a set of binaries to be created. An acceptable solution would be to do the test upon calling rdmd (it should work with --build-only flag). Furthermore, I think this could be made to work with dmd itself (even with di files) by having a data in the object files indicating the module dependencies, so that dmd will have all the info to do the test at CT. Eg: dmd -c a.d -Hfa.di dmd main.d a.di -ofmain => should be able to detect cycles.