Beyond the veil: What's after type functions
Stefan Koch
uplink.coder at googlemail.com
Thu Jan 7 13:50:04 UTC 2021
On Wednesday, 6 January 2021 at 14:08:15 UTC, sighoya wrote:
> 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.
>
Indeed templates are enough for that.
The issue comes when you want a typefunction to instantiate a
template
given a type value, since those values are runtime arguments,
(even though they are evaluated by CTFE)
they cannot be a compile time argument to a template.
As that could change the shape of the function body
(which would make caching impossible and require us to copy the
function body on every call).
I don't see that much of an issue to have 2 ways of doing the
same thing.
We have that all the time when a lower-level feature gets
supplemented with a higher level one.
You just chose the right way for your abstraction level and
performance requirements.
In the end there is not wanted wanting to convince people without
data.
I am going to run my experiments and we'll see what comes out :)
More information about the Digitalmars-d
mailing list