On type functions

Stefan Koch uplink.coder at googlemail.com
Sun May 3 15:28:17 UTC 2020


On Sunday, 3 May 2020 at 15:12:32 UTC, Steven Schveighoffer wrote:
>
> This is cool, but we can already do this (as Adam says). Would 
> it not be more prudent for this to just be a UDA that says 
> "don't put in symbol table"?
>
> What I want is symbol manipulation like variables.
>
> i.e.:
>
> alias types = AliasSeq!(int, char, bool);
>
> alias[] ctSort(alias[] items) { return sort!(t => 
> t.name)(types); } // or something like this
>
> static assert(is(ctSort(types) == AliasSeq!(bool, char, int)));
>
> I can already do this too, but painfully.
>
> -Steve

alias[] is something that comes with type functions.
when returned an alias[] becomes a tuple.
But within a type function an alias[] can be assigned to.
And "~=" works for it.


More information about the Digitalmars-d mailing list