Trying to do alias template deduction myself.

Elfstone elfstone at yeah.net
Wed Apr 5 04:09:27 UTC 2023


On Friday, 31 March 2023 at 05:19:48 UTC, Elfstone wrote:
> [..]

Hi all! I've pushed my code:
https://github.com/Lucipetus/dmd/tree/fix_alias_template_deduction
And here's my test code:
https://github.com/Lucipetus/dmd_test - Run `dmd atifti.d`

I'll have a look on `static assert(isInstance!(Regex, 
Regex!char))`, it still fails, but `static 
assert(is(Vector3!float == Vector3!U, U))` now compiles!

The fix is really, really simple, as I've explained in my last 
reply: recursively call `deduceType`, match the output with 
largely the same code as the original matching routine `L2:` - as 
you can see, my matching is simply an abridged version of the 
original. I think ideally we can share the same code, which 
requires modifying the original - I don't think I'm qualified to 
do that. But I think it's a proof of idea. We can do IFTI for 
alias template!

Another thing. I was thinking of `alias AliasT(U:U*) = TempT(U)`, 
but found out IFTI couldn't resolve this: 
https://github.com/Lucipetus/dmd_test/blob/master/iftilim.d `void 
foo(U : U*)(TempT!U v)`, so why bother?


More information about the Digitalmars-d mailing list