Asking for the opinion of DMD developers
Elie Morisse
syniurge at gmail.com
Sun Oct 13 16:28:00 UTC 2019
On Sunday, 13 October 2019 at 10:51:52 UTC, Stefanos Baziotis
wrote:
> [1] https://github.com/dlang/DIPs/pull/176
> [2]
> https://forum.dlang.org/post/dnyqxmgdazczwmmvayjx@forum.dlang.org
I read your DIP and the review thread.
> if (arg is templateInstance && arg.TD is
> aliasTemplateDeclaration) {
Checking that a TemplateDeclaration is an "alias template
declaration" is easy : TemplateDeclaration.onemember &&
TemplateDeclaration.onemember.isAliasDeclaration()
However since they may be more than one TemplateDeclaration
overload, your templateInstance cannot exist yet and you don't
know which TemplateDeclaration overload should be probed..
A possible solution like C++'s, but taking into account the
multiplicity of TemplateDeclaration overloads would be:
- If the first round of arg deduction fails, try transforming
the TypeFunction by substituting each function parameter that
failed matching with a dummy instance from each
TemplateDeclaration overload that contains an alias (one
substitution attempt per overload) and redo the arg deduction.
For each function parameter, no more than one TemplateDeclaration
overload must match or else it's ambiguous.
- If every combination of "one substitution per param" fails,
keep substituting the remaining non-matching already substituted
function parameters until there's no deeper alias template (i.e
no more alias Temp(T) = SomeOtherAliasTemp(T)).
Downside : there may be A LOT of possible combinations.
More information about the Digitalmars-d
mailing list