[Dlang-internal] di files vs CTFE

Jean-Louis Leroy via Dlang-internal dlang-internal at puremagic.com
Fri Aug 4 19:12:33 PDT 2017


On Saturday, 5 August 2017 at 01:05:41 UTC, Stefan Koch wrote:
> On Saturday, 5 August 2017 at 00:45:51 UTC, Jean-Louis Leroy 
> wrote:
>> On Friday, 4 August 2017 at 16:33:06 UTC, Stefan Koch wrote:
>>> On Friday, 4 August 2017 at 13:55:29 UTC, Jean-Louis Leroy 
>>> wrote:
>>>> Hi,
>>>>
>>>> While working on my openmethods library, I came across a gap 
>>>> that may be worth filling.
>>>>
>>>> [...]
>>>
>>> make the function return auto.
>>> Then you'll have the body.
>>
>> Thanks. This is, hmmm, surprising ;-)
>
> for the auto return type to work the compiler needs to infer it.
> in order to infer it you need the body ;)

I see...OTOH the compiler could resolve the return type when 
generating the .di file, then the body would not be needed 
anymore. I changed my registerMethods back from a template to an 
auto function but I feel that I am in undocumented territory here.


More information about the Dlang-internal mailing list