digitalmars.D.bugs - [Issue 13242] New: imported aliases should be analyzed lazily
- via Digitalmars-d-bugs (29/29) Aug 01 2014 https://issues.dlang.org/show_bug.cgi?id=13242
https://issues.dlang.org/show_bug.cgi?id=13242 Issue ID: 13242 Summary: imported aliases should be analyzed lazily Product: D Version: unspecified Hardware: x86_64 OS: Linux Status: NEW Severity: enhancement Priority: P1 Component: DMD Assignee: nobody puremagic.com Reporter: code dawg.eu The following problem is pretty frequent. lib.d alias apiSymbol = expensiveTemplate!SomeArgs; void cheapFunc() {} client.d import lib; void main() { cheapFunc(); } Although the client only uses cheapFunc the compiler will still run semantic on the expensive template instance. This is a major slowdown and it also makes it useless to localize additional imports in the template. The semantic of the aliased symbol should be deferred until the alias is actually used. Even if it's used we should not generate code for the template, because that was already done when compiling lib. To allow this deferring should only happen for aliases in non-root modules. I think it a sane proposal and it will have a big impact on compile times. --
Aug 01 2014