static map as a type function

Bruce Carneal bcarneal at gmail.com
Wed Sep 23 23:59:44 UTC 2020


On Wednesday, 23 September 2020 at 22:36:55 UTC, Walter Bright 
wrote:
> On 9/23/2020 4:49 AM, Per Nordlöw wrote:
>> Great work. Has Andrei given any advice on how to proceed 
>> regarding dip, reviews and acceptance? I presume this will get 
>> merged behind a -preview if it gets merged.
>
> The other way to do it is just have the compiler recognize 
> recursive templates and implement them directly. This would 
> provide the speedup, while not adding new features or requiring 
> any user code changes - it'll just run faster.

I see a few reasons to prefer type functions, wherever applicable 
(they cant do everything):

1) type functions admit a simpler/bounded compiler implementation

2) type functions admit simpler meta programs and the related

3) type functions should be easier to debug, eager rather than 
lazy/latent compile time errors for one thing

4) type functions exhibit better locality than templates

5) to achieve type function like simplicity/debuggability with 
templates you need to rely more heavily on "best practices"






More information about the Digitalmars-d mailing list