Thread overview
[Issue 19139] Need a convenient syntax for invoking nested eponymous templates
[Issue 19139] Need a convenient syntax for invoking nested templates
Aug 05, 2018
Simen Kjaeraas
Dec 17, 2022
Iain Buclaw
May 05
basile-z
August 05, 2018
https://issues.dlang.org/show_bug.cgi?id=19139

Simen Kjaeraas <simen.kjaras@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |simen.kjaras@gmail.com
           Hardware|x86_64                      |All
                 OS|Linux                       |All

--- Comment #1 from Simen Kjaeraas <simen.kjaras@gmail.com> ---
import std.meta : Instantiate;

template A() {
    template A() {
        enum A = 1;
    }
}

unittest {
    enum i = Instantiate!(A!());
}

Now, that shows it's possible in the language to work around this issue. The real issue however, is that multiple ! arguments are not allowed.

>From what I can gather on the forum, the reason is a perceived ambiguity, in
that F!T!int could mean F!(T!int) or (F!T)!int. The language already provides tools to disambiguate between them - the first example is how you'd invoke it that way, and the other example is simply impossible in the language right now.

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=19139

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P4

--
May 05
https://issues.dlang.org/show_bug.cgi?id=19139

basile-z <b2.temp@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Need a convenient syntax    |Need a convenient syntax
                   |for invoking nested         |for invoking nested
                   |templates                   |eponymous templates

--