https://issues.dlang.org/show_bug.cgi?id=13242

--- Comment #4 from Kenji Hara <k.hara...@gmail.com> ---
(In reply to Martin Nowak from comment #0)
> 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.

If the instantiation expensiveTemplate!SomeArgs contains some errors but
apiSymbol is not used, the error won't be reported? It sounds not good.

--

Reply via email to