On Wednesday, 15 January 2025 at 21:55:30 UTC, monkyyy wrote:
On Wednesday, 15 January 2025 at 21:00:35 UTC, realhet wrote:
On Wednesday, 15 January 2025 at 20:27:18 UTC, Steven Schveighoffer wrote:
On Wednesday, 15 January 2025 at 12:01:21 UTC, realhet wrote:

Also seems like invalid syntax. Where does this come from?

It's in std.typecons.d -> [git link](https://github.com/dlang/phobos/blob/336bed6d8ffec74d117b755866c5bd22e3d610a1/std/typecons.d#L2278C4-L2279C18)

It's in the declaration of enum isTuple(T) = ....

github: `f(Specs...)(Tuple!Specs tup)`

your post: `template f(Specs...)f(T.init);`

thats quite the important detail, its pattern matching

Thanks, I understand it now. It indeed valid in the typecons.d module.
- A declaration of a template function f with empty body {}
- And the it calls the f function with the T.init parameter.

And this is how I got that weird template declaration later:

Run this commmand:
```
ldc2 -o- -X c:\d\ldc2\import\std\typecons.d
```

The resulting typecons.json file will fontain information about the isTuple declaration:
```json
{
    "kind" : "template",
    "protection" : "public",
    "line" : 2277,
    "char" : 6,
    "name" : "isTuple",
    "parameters" : [
     {
      "name" : "T",
      "kind" : "type"
     }
    ],
    "members" : [
     {
      "name" : "isTuple",
      "kind" : "variable",
      "line" : 2277,
      "char" : 6,
      "storageClass" : [
       "enum"
      ],
"init" : "__traits(compiles, ()\r\n{\r\ntemplate f(Specs...)f(T.init);\r\n}\r\n)"
     }
    ]
   }
```

And there it is, inside the "init" field.

So it seems like that X Json exporter had a little bug there. It misinterprets the 'f' function declaration and the 'f' function calling statements.

Otherwise I'm happy because I've managed to put together a 6MB DLang-ish file with all the declarations in Phobos. And the only error was this.

(Why I do this? -> I want to make something like IntelliSense. Now that I have all the data loaded from the X Json files, I transformed them into a large D source to be able to verify. This is what it looks like: [youtube link](https://www.youtube.com/watch?v=GGrpEVsqCeY))
  • Template declara... realhet via Digitalmars-d-learn
    • Re: Templat... monkyyy via Digitalmars-d-learn
      • Re: Tem... realhet via Digitalmars-d-learn
        • Re:... realhet via Digitalmars-d-learn
          • ... monkyyy via Digitalmars-d-learn
            • ... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
              • ... monkyyy via Digitalmars-d-learn
    • Re: Templat... Steven Schveighoffer via Digitalmars-d-learn
      • Re: Tem... realhet via Digitalmars-d-learn
        • Re:... monkyyy via Digitalmars-d-learn
          • ... realhet via Digitalmars-d-learn

Reply via email to