Beyond the veil: What's after type functions

sighoya sighoya at gmail.com
Wed Jan 6 14:08:15 UTC 2021


On Monday, 4 January 2021 at 19:30:31 UTC, Stefan Koch wrote:
> With this in mind, please tell me what you think :)

I like the idea of type functions for type calculus only, because 
it's easier to get the work done and feels more natural as it is 
pure D-code, not a foreign language to talk with.

Though I wouldn't choose them to introduce generics in D, I think 
templates are enough for that part.


>templates build up stuff and to see what it does you have to 
>instantiate it.
>templates generally don't allow higher level reasoning.

>type functions are by nature pure and state transformations or 
>reductions.
>Which you can reason about in isolation.

Both templates and type functions are functions, the former takes 
code and maps them to other code internally over AST Nodes, the 
latter takes first class values and maps them to first class 
values.

Though, type functions are easier to handle than templates as 
templates aren't really first class functions in D.




More information about the Digitalmars-d mailing list