Create an Algebraic type at compile time and more
uknys
uknysx at pm.me
Sat Jun 16 20:12:56 UTC 2018
On Friday, 15 June 2018 at 12:03:28 UTC, Simen Kjærås wrote:
> On Friday, 15 June 2018 at 10:53:35 UTC, uknys wrote:
>> On Friday, 15 June 2018 at 07:27:22 UTC, Simen Kjærås wrote:
>>> [snip]
>>
>> Yeah I saw that Algebraic doesn't work at compile time, then I
>> thought of using an Interface with one function (execute())
>> and making Hello and Toto as classes implementing even if
>> that's somewhat slower.
>> Then I could use pragma(msg,
>> getSymbolsByUDA!(mixin(__MODULE__), X)); and make an array
>> sorted by opcode of this interface. Am I right about this ?
>
> That would be the idea, yes.
>
> --
> Simen
I found about the sumtype package that does the same thing as
Algebraic but also works at compile time, so here is my idea
implemented :
https://gist.github.com/uknys/dc47a092ff900f8c99f221eda8c9ab42
More information about the Digitalmars-d-learn
mailing list