[Issue 9365] Allow partially specified template aliases
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Nov 10 13:31:03 PST 2013
https://d.puremagic.com/issues/show_bug.cgi?id=9365
--- Comment #6 from monarchdodra at gmail.com 2013-11-10 13:31:00 PST ---
In reply to comment #4)
> (In reply to comment #3)
> > Something like
> >
> > alias A(T) = B!(x, T);
> >
> > Is more likely and more flexible.
>
> See my use case, with your suggestions, this wouldn't work:
>
> alias equalRoR = equal!equal;
>
> An alternative suggestion, is to change how function templates are expanded.
> Currently we have:
>
> void foo(A, B)(A a, B b)
>
> expanding to
>
> template foo(A, B)
> {
> void foo(A a, B b);
> }
>
> If instead, it expanded to:
>
> template foo(A)
> {
> template foo(B)
> {
> void foo(A a, B b);
> }
> }
>
> Then foo!int becomes a valid, alias-able symbol, which would solve the problem
> as well.
I think this would also come with its own problems:
For example, how would you tell apart full/partial, eg:
void foo(U)();
void foo(U, V)();
alias F = foo!int; //which one is this?
There's also some problems with constraints. It's difficult to do what you
suggest if there is a constraint that depends on both A/B. At best, you can
validate when the last parameter is specified.
--
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list