taggedalgebraic 0.11.0 adds TaggedUnion

Sönke Ludwig sludwig+d at outerproduct.org
Sat Feb 23 20:49:43 UTC 2019


Am 23.02.2019 um 21:46 schrieb Sönke Ludwig:
> Am 23.02.2019 um 20:19 schrieb Paul Backus:
>> On Friday, 22 February 2019 at 17:09:41 UTC, Sönke Ludwig wrote:
>>>  - Behaves like a POD if only POD fields exist, is non-copyable if any
>>>    contained type is non-copyable etc.
>>
>> In fact, if a contained type is non-copyable, it fails to compile 
>> altogether. (Example code below.)
>>
>> Granted, so do Algebraic and SumType, so this isn't a knock against 
>> taggedalgebraic in particular. But it does indicate poor test coverage 
>> that you listed this feature without realizing it didn't work.
>>
>> --- example.d
>> /+ dub.sdl:
>> dependency "taggedalgebraic" version="~>0.11.2"
>> +/
>> import taggedalgebraic;
>>
>> struct NoCopy { @disable this(this); }
>> union U { NoCopy member; }
>> alias Test = TaggedUnion!U; // kaboom
>>
>> void main() {}
>>
> 
> You are right, I was actually aware of some places where the value is 
> not moved/swapped properly, but I forgot about it when rushing the post 
> before leaving. The test coverage is actually pretty good, though, even 
> if it is hard to give a meaningful number for template-heavy code like 
> that.

https://github.com/s-ludwig/taggedalgebraic/pull/26


More information about the Digitalmars-d-announce mailing list