Possible solution to template bloat problem?

Dicebot public at dicebot.lv
Mon Aug 19 13:37:35 PDT 2013


Just two words: "separate compilation".

Any solution that is going to address template problem needs to 
improve current state with such compilation model, not make it 
even worse.

As an alternative, I have proposed one of two approaches (or 
both):

1) Stop dumping all symbols into root module supplied from the 
command line. Emit symbols to object files that match modules 
they were instantiated from. If symbol has no valid source point 
(== constraint or CTFE) than don't emit it at all.

2) Create object files in format that allows usage of `ld 
--gc-sections` (garbage collection of unused symbols upon 
linking). Don't know if similar thing exists for Windows.

Latter should be relatively easy to do but it is not 
cross-platform and it does not help build systems with tracking 
rebuild conditions.

Former feels like a proper approach and I have been working on it 
(also @eskimor) for some time. But it is rather hard as relevant 
code does not seem to track required information at all and 
probably no one but Walter knows all minor details about its 
design. To sum it up - I have not been able to produce a pull 
request that passes the test suite so far (though I have put it 
on hold for some time, going to return to this).


More information about the Digitalmars-d mailing list