CTFE and DI: The Crossroads of D

deadalnix deadalnix at gmail.com
Thu May 10 01:44:51 PDT 2012


Le 10/05/2012 05:00, Andrei Alexandrescu a écrit :
> Actually the point here is to still be able to benefit of di automated
> generation while opportunistically marking certain functions as "put the
> body in the .di file".
>
> @inline anyone?
>
>
> Andrei

I think this logic is flawed. Removing implementation of a function have 
drawbacks (it is not CTFEable for instance). It should be done :
  - If it doesn't make sens anyway to include the body (non CTFEable 
function for instance).
  - If the user choose to do so (to hide code source behind an API for 
instance).
  - If the code is not callable throw exposed one (private function that 
aren't called from any other piece of code where the source code 
remains). This is one is a "garbage collection process"

You don't want to strip all source code by default. With the "garbage 
collection" trick, you only need to mark your API to get mostly 
everything removed. This is a much better approach.


More information about the Digitalmars-d mailing list