I've just fixed UFCS for the experimental type function branch

Stefan Koch uplink.coder at googlemail.com
Thu Sep 10 09:43:34 UTC 2020


Hi there,

just a quick update.
limited UFCS for type functions works again.
i.e.

this code:

---
struct S1 { double[2] x; }

static assert(S1.sizeOf == S1.sizeof);

size_t sizeOf(alias t)
{
     return t.sizeof;
}
---

will work.

There are a few caveats in the current POC implementation of 
type-function UFCS, which mean this will only apply to single 
type variables (`alias x;`)
and not to arrays of them, it also won't work for structures 
which have alias variable members.

If you want to play with it, the code is downloadable at:
https://github.com/UplinkCoder/dmd/tree/talias_master

which contains the type function changes applied on a current dmd 
~master.

Happy Hacking,

Stefan


More information about the Digitalmars-d mailing list