TypeFunction example creatiing a conversion matrix
Stefan Koch
uplink.coder at gmail.com
Thu Oct 1 18:41:00 UTC 2020
On Thursday, 1 October 2020 at 18:30:31 UTC, Andrei Alexandrescu
wrote:
> std.variant. The latter can be considered a problem of having
> the right primitives in std.traits.
I don't think that std.variant can ever work cleanly.
Either you are a dynamically typed language, or you aren't.
We can approach, dynamism by emulating it in templates, but
reaching it ... quite probably impossible.
While is an interesting consideration, it's not at all what type
functions solve.
An accurate definition of what type functions allow you to do,
and what they are designed to do is:
- Replacing templates which could be functions with functions.
- i.e. If the only reason you are using a template instead of a
function is that functions can't take types or a list of types.
Then that's in the problem domain of type functions.
More information about the Digitalmars-d
mailing list