Compiler-recognized template patterns

Quirin Schroll qs.il.paperinik at gmail.com
Tue Jul 23 09:36:21 UTC 2024


 From [D Language Foundation March 2024 Monthly Meeting 
Summary](https://forum.dlang.org/post/qwyhlvqintqsnzwnzuwv@forum.dlang.org)
> Walter said the way to do that was to have the compiler 
> recognize the template and not instantiate it, but just return 
> the result. He'd done that for a couple of the templates. 
> `Unqual` sounded like a good candidate for that. Then it would 
> still look like a template, but it wouldn't have the cost of a 
> template anymore.

That’s not a good solution, it’s just whack-a-mole. Why not add a 
pragma so that any template can be like that at the programmer’s 
discretion? `pragma(nocache)` or something like that. We can add 
it to any Phobos template and D programmers can add it in their 
code bases where they see fit.


More information about the Digitalmars-d mailing list