Introduction to programming with compile time sequences in D

Petar Petar
Tue Aug 25 16:39:54 UTC 2020


On Tuesday, 25 August 2020 at 16:10:21 UTC, data pulverizer wrote:
> On Tuesday, 25 August 2020 at 16:01:25 UTC, data pulverizer 
> wrote:
>> On Tuesday, 25 August 2020 at 14:02:33 UTC, Petar Kirov 
>> [ZombineDev] wrote:
>>> ...
>>> You can find a full example of this here:
>>> https://run.dlang.io/gist/run-dlang/80e120e989a6b0f72fd7244b17021e2f
>>>
>> There is an issue with `AliasTuple` though, you can't directly 
>> print its collections with pragma:
>>
>> ```d
>> alias coll = AliasSeq!(s1, s2, s3, s7);
>> pragma(msg, coll);
>> ```
>>
>> I get the following error:
>>
>> ```d
>> onlineapp.d(29): Error: cannot interpret AliasTuple!1 at 
>> compile time
>> onlineapp.d(29): Error: cannot interpret AliasTuple!(1, 2) at 
>> compile time
>> ...
>> tuple((__error), (__error), (__error), (__error))
>> ```
>
> p.s. I did include a `Tuple` - like implementation in my 
> article at the later sections, but it was based on a template 
> struct.

Yeah, I agree that using structs offers better ergonomics. Such 
design also enables cool things like UFCS and lambda functions. 
You can find an example of this here: 
https://gist.github.com/PetarKirov/a808c94857de84858accfb094c19bf77#file-rxd-meta2-d-L65-L123


More information about the Digitalmars-d-announce mailing list