On Saturday, 14 June 2025 at 00:26:27 UTC, monkyyy wrote:
I believe every change in compilation from (top level)
declaration order is considered a compiler bug
However, I see.... Allot of issues with this code, Id want to
see something near functional code around this subject; its
worth poking, but its possible every possible way to make this
code work would eliminate the pattern here
for example this compiles:
```d
import std;
struct S{}
template f(void function(S) F) {alias f=void;}
template f(int function(S) F) {alias f=int;}
unittest{
alias a=f!((_) {});
alias b=f!((_) => 0);
a.stringof.writeln;
b.stringof.writeln;
}
```
mixin templates vs declaration templates was a bad decision in
my opinion but thats old news.
Mixin templates and regular templates have different use cases:
the former can inject declaration on caller's site while the
latter can't.
In my case mixin template generates top-level `main()` function
but the content of the template is not important here.
Also using `alias F` as template parameter doesn't allow me to
introspect the actual type.