How is this code supposed to work?

AndreasDavour andreas.davour at protonmail.ch
Fri Jan 25 20:16:47 UTC 2019


On Friday, 25 January 2019 at 16:19:38 UTC, Neia Neutuladh wrote:
> 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.

Thanks! I had some issues with the syntax, and getting that part 
correct got me to the conceptual bits, which is where I got lost 
for real. Syntax errors are such a drag, though.

Appreciated.


More information about the Digitalmars-d-learn mailing list