@ctfeonly

Nicholas Wilson iamthewilsonator at hotmail.com
Thu Dec 7 03:39:31 UTC 2017


On Thursday, 7 December 2017 at 02:33:49 UTC, ketmar wrote:
> H. S. Teoh wrote:
>
>> On Thu, Dec 07, 2017 at 01:21:11AM +0000, Nicholas Wilson via 
>> Digitalmars-d wrote:
>>> [...]
>>
>> I'd like to have this too.  Some of my template-heavy code use 
>> a good
>> number of CTFE-only functions that are only called at 
>> compile-time.
>> Since they are nested inside the template, they do quickly add 
>> up to a
>> lot of dead code in the executable.  Having a @ctfeonly 
>> annotation that
>> tells the compiler not to codegen the (many instantiations of 
>> the)
>> function would be greatly welcomed.
>>
>>
>> T
>
> this is a hack for something that really should be done in 
> linker, automatically. please, people, let's not turn D into 
> C++! ;-)
>
> i mean: this has a short-time benefits, but makes the language 
> more complex, less clear, and completely destroys any incentive 
> to make smartlinking work as intended in case it is broken.

Not all of the generated code goes through a linker ;)
For dcompute strings aren't even supported yet! Let alone 
concatenation.

Also not generating the code in the first place means less I/O 
for the compiler and less work for the linker.

I definitely don't want D to become C++. What is smartlinking?

This is intended for stuff like code that generates strings for 
mixins.


More information about the Digitalmars-d mailing list