How is this code supposed to work?

Neia Neutuladh neia at ikeran.org
Fri Jan 25 16:19:38 UTC 2019


On Fri, 25 Jan 2019 09:34:47 +0000, AndreasDavour wrote:
>    auto point3 = getResponse!Point!int("What's the point? ");

This could be:

    getResponse!(Point!int)

or:

    (getResponse!Point)!int

D requires this to be disambiguated at the parsing stage, before the 
compiler works out what getResponse might be.

An example of the latter:

template getResponse(alias n)
{
    alias getResponse = n;
}

getResponse!Point is just Point.

I'm not sure why that tutorial has it wrong, but the way to get it fixed 
is to contact the author.


More information about the Digitalmars-d-learn mailing list