Making template instantiations more lazy

Biotronic simen.kjaras at gmail.com
Wed Oct 18 10:17:38 UTC 2017


On Wednesday, 18 October 2017 at 09:56:33 UTC, Nordlöw wrote:
> On Wednesday, 18 October 2017 at 09:32:39 UTC, Jonathan M Davis 
> wrote:
>> On Wednesday, October 18, 2017 09:13:47 Per Nordlöw via 
>> Digitalmars-d-learn wrote:
>>> Are there any nearby plans to make more template 
>>> instantiations (especially aggregate members) lazy in DMD?
>>>
>>> Are there any specific obstacles against doing that or has it 
>>> just not been prioritized?
>>
>> Templates are never instantiated unless they're actually... 
>> well, instantiated. So, they're already lazy in that sense. 
>> The compiler isn't pre-emptive with them at all. What exactly 
>> about them do you want to be lazy that isn't?
>>
>> - Jonathan M Davis
>
> Member functions of templated containers is my main focus.

Make them templates, that should solve the problem:

struct S(T) {
     void foo()() {
         compileerror;
     }
}


More information about the Digitalmars-d-learn mailing list