Template declaration of std.typecons.isTuple in -X JSON file.
realhet
real_het at hotmail.com
Wed Jan 15 12:01:21 UTC 2025
Hello,
I'm working on understanding and automating the contents of an X
Json file generated by LDC2.
I'm testing it by processing the whole Phobos lib.
The weirdest thing that I've found is this:
X Json:
```
```
With my program, I transformed into this header source code:
```d
public template isTuple(T) {enum isTuple = __traits(compiles, ()
{
template f(Specs...)f(T.init);
}
);}
```
Then the parser in my custom IDE was stopped with error: It can't
handle template with the ';' ending.
So I temporarily enabled that form, but I can't find that
template; form in the documentation. I only found info about
template{}.
Later I've found that the "template f(Specs...)f(T.init);" thing
is also in the DDoc of the std.typecons.d module.
```d
enum isTuple(T) = __traits(compiles, () { template
f(Specs...)f(T.init); } );
```
(It's just embedded code in the json as a string. So it was the
same at me as well.)
Anyone can explain me what
```d
template f(Specs...)f(T.init);
```
means?
From now on, I will detect it as valid, but please help me
understand it.
Thx in advance!
More information about the Digitalmars-d-learn
mailing list