How can I have those "template instance recursive expansion" errors under control?
realhet
real_het at hotmail.com
Tue Dec 3 13:18:26 UTC 2024
On Sunday, 1 December 2024 at 21:35:43 UTC, monkyyy wrote:
> On Sunday, 1 December 2024 at 20:29:30 UTC, realhet wrote:
>>
>> Update: This not works!
>
> You have more code in that one file then I try to have in a
> *project*, so idk but if your still looking at the file, may as
> well say my thing
The reason for my big modules is this:
I build them in parallel, one module = one LDC instance. So I
just can't have a module for every sneeze :D (Until I make
possible to group them...)
To compensate it, I have a lot of region blocks:
version(/+$DIDE_REGION region caption+/all){}
I use those to make a hierarchical order inside large modules.
These are files, they can be nested.
> enum isNumberic(T:Vector!(S,N),S,size_T N)=true;
Thanks for the example code, I was surprised that it runs. This
crazy enum format with the separate =true and =false was new to
me. I've checked isNumeric(), and the same stuff is inside that.
I use this format:
```d
enum isVector(T) = is(T==Vector!(CT, N), CT, int N);
enum isScalar(T) = is(T==bool) || isNumeric!T;
```
I tried yours, but nothing changed, the current solution to this
inter-module template-type-alias problem is:
1. In the target module: 'mentioning' the vector type `auto dummy
= Vector!(ubyte, 3)(0);` before using the alias `RGB(1, 2, 3)`
2. In the math module: 'mentioning' it with a `pragma(msg,
Vector!(ubyte, 3).stringof[0..0]);` (Only this works, not a
dummy declaration.)
Both solutions are lame :D
But the one inside the math module is hidden, so the production
modules can contain nice non-redundant code.
More information about the Digitalmars-d-learn
mailing list