Re: Wrapper around a recursive data type

2024-07-08 Thread Steven Schveighoffer via Digitalmars-d-learn
On Monday, 8 July 2024 at 08:56:51 UTC, drug007 wrote: How can I "break" this recursion or some other work around to fix it? A few ideas: 1. If it's immediately recursive (that is, contains a pointer to itself), just use the type itself somehow. You may not be able to do this with recursive

Re: Wrapper around a recursive data type

2024-07-08 Thread Steven Schveighoffer via Digitalmars-d-learn
On Monday, 8 July 2024 at 13:29:05 UTC, user1234 wrote: On Monday, 8 July 2024 at 08:56:51 UTC, drug007 wrote: I need to generate some meta info of my data types. I do it this [...] How can I "break" this recursion or some other work around to fix it? Use `Node*[]` for the children type.

Re: Wrapper around a recursive data type

2024-07-08 Thread Steven Schveighoffer via Digitalmars-d-learn
On Tuesday, 9 July 2024 at 03:04:50 UTC, Steven Schveighoffer wrote: Can you post the error and the exact code that fails? I tried building this (with the children uncommented out) and it works fine. Ignore this, I didn't really read the whole message. -Steve

Re: Wrapper around a recursive data type

2024-07-08 Thread Steven Schveighoffer via Digitalmars-d-learn
On Monday, 8 July 2024 at 08:56:51 UTC, drug007 wrote: I need to generate some meta info of my data types. I do it this [way](https://gist.github.com/drug007/b0a00dada6c6ecbf46b4f6988401d4e2): ```D import std.range, std.format, std.stdio, std.traits; struct NestedType { string s;

Re: Weird std.path API?

2024-07-08 Thread user1234 via Digitalmars-d-learn
On Monday, 8 July 2024 at 07:29:27 UTC, aberba wrote: On Sunday, 7 July 2024 at 15:35:36 UTC, Andrey Zherikov wrote: On Sunday, 7 July 2024 at 14:49:52 UTC, Anonymouse wrote: On Sunday, 7 July 2024 at 14:41:31 UTC, Andrey Zherikov wrote: ```d import std.path; // Error: no property

Re: Wrapper around a recursive data type

2024-07-08 Thread user1234 via Digitalmars-d-learn
On Monday, 8 July 2024 at 08:56:51 UTC, drug007 wrote: I need to generate some meta info of my data types. I do it this [...] How can I "break" this recursion or some other work around to fix it? Use `Node*[]` for the children type. That way the compiler knows the size of the (previously)

Wrapper around a recursive data type

2024-07-08 Thread drug007 via Digitalmars-d-learn
I need to generate some meta info of my data types. I do it this [way](https://gist.github.com/drug007/b0a00dada6c6ecbf46b4f6988401d4e2): ```D import std.range, std.format, std.stdio, std.traits; struct NestedType { string s; double d; } struct Node { string value; int i;

Re: Weird std.path API?

2024-07-08 Thread aberba via Digitalmars-d-learn
On Sunday, 7 July 2024 at 15:35:36 UTC, Andrey Zherikov wrote: On Sunday, 7 July 2024 at 14:49:52 UTC, Anonymouse wrote: On Sunday, 7 July 2024 at 14:41:31 UTC, Andrey Zherikov wrote: ```d import std.path; // Error: no property `asNormaliedPath` for `dirName("/sandbox/onlineapp.d")` of type