May 16, 2013 Re: Shameless autopromotion : type safe tagged union in D | ||||
---|---|---|---|---|
| ||||
Posted in reply to deadalnix | On Fri, 10 May 2013 14:32:48 +0200
"deadalnix" <deadalnix@gmail.com> wrote:
> http://www.deadalnix.me/2013/05/10/type-safe-tagged-union-in-d-programming-language/
>
> A trick that I used to use more and more, so I ended up creating a generic solution and wrote an article about it.
Nice article, but is there any particular problem with std.variant.Algebraic?
|
May 17, 2013 Re: Shameless autopromotion : type safe tagged union in D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nick Sabalausky | On Thursday, 16 May 2013 at 18:30:22 UTC, Nick Sabalausky wrote:
> On Fri, 10 May 2013 14:32:48 +0200
> "deadalnix" <deadalnix@gmail.com> wrote:
>
>> http://www.deadalnix.me/2013/05/10/type-safe-tagged-union-in-d-programming-language/
>>
>> A trick that I used to use more and more, so I ended up creating a generic solution and wrote an article about it.
>
> Nice article, but is there any particular problem with
> std.variant.Algebraic?
Yes, : it is user responsibility to poll types and act accordingly. In the presented code, this is the responsibility of the data structure.
For instance, if I add a new type, with Algebraic, I'll have to go over all my code base to patch every use. If I don't, my code become silently incorrect. With the presented solution, I'll get a compile time error.
|
Copyright © 1999-2021 by the D Language Foundation