On type functions

Steven Schveighoffer schveiguy at gmail.com
Sun May 3 15:53:21 UTC 2020


On 5/3/20 11:28 AM, Stefan Koch wrote:
> 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.
>>
> 
> 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.

OK. You should have lead with that ;)

Looking forward to it.

-Steve


More information about the Digitalmars-d mailing list