Re: sumtype 0.5.0

2018-08-22 Thread Paul Backus via Digitalmars-d-announce
On Wednesday, 8 August 2018 at 20:54:13 UTC, Paul Backus wrote: SumType is a generic sum type for modern D. It is meant as an alternative to `std.variant.Algebraic`. New point release, 0.5.3, with the following updates: - SumType now uses the smallest possible integer type for its tag (e.g.,

Re: sumtype 0.5.0

2018-08-10 Thread Paul Backus via Digitalmars-d-announce
On Friday, 10 August 2018 at 21:28:40 UTC, Everlast wrote: Yes, but alias Z = SumType.Union(X,Y); is not the same as alias Z = SumType!(int, float, string, complex, vector). In the first case Z is actually a union of 2 types while in the second it is of 5. There is a subtle difference

Re: sumtype 0.5.0

2018-08-10 Thread Everlast via Digitalmars-d-announce
On Friday, 10 August 2018 at 19:19:39 UTC, Paul Backus wrote: On Friday, 10 August 2018 at 13:11:13 UTC, Everlast wrote: On Friday, 10 August 2018 at 12:35:18 UTC, Everlast wrote: It would be nice if some actual examples could be given. The help on dub is a bit confusing because the the code

Re: sumtype 0.5.0

2018-08-10 Thread Paul Backus via Digitalmars-d-announce
On Friday, 10 August 2018 at 13:11:13 UTC, Everlast wrote: On Friday, 10 August 2018 at 12:35:18 UTC, Everlast wrote: It would be nice if some actual examples could be given. The help on dub is a bit confusing because the the code is not complete. In addition to the example on the dub

Re: sumtype 0.5.0

2018-08-10 Thread Everlast via Digitalmars-d-announce
On Friday, 10 August 2018 at 12:35:18 UTC, Everlast wrote: On Thursday, 9 August 2018 at 15:56:12 UTC, Paul Backus wrote: On Wednesday, 8 August 2018 at 20:54:13 UTC, Paul Backus wrote: SumType is a generic sum type for modern D. It is meant as an alternative to `std.variant.Algebraic`.

Re: sumtype 0.5.0

2018-08-10 Thread Everlast via Digitalmars-d-announce
On Thursday, 9 August 2018 at 15:56:12 UTC, Paul Backus wrote: On Wednesday, 8 August 2018 at 20:54:13 UTC, Paul Backus wrote: SumType is a generic sum type for modern D. It is meant as an alternative to `std.variant.Algebraic`. Version 0.5.2, with fixes for the bugs reported in this thread,

Re: sumtype 0.5.0

2018-08-09 Thread Paul Backus via Digitalmars-d-announce
On Wednesday, 8 August 2018 at 20:54:13 UTC, Paul Backus wrote: SumType is a generic sum type for modern D. It is meant as an alternative to `std.variant.Algebraic`. Version 0.5.2, with fixes for the bugs reported in this thread, is now available. Thanks to vit for their detailed feedback!

Re: sumtype 0.5.0

2018-08-09 Thread Paul Backus via Digitalmars-d-announce
On Thursday, 9 August 2018 at 07:52:12 UTC, vit wrote: SumType without initialization doesn't fail if first type has @disabled this(). It did fail for me, but it also failed *with* initialization too, so there was definitely a bug there. method toString is not template. (why is there in the

Re: sumtype 0.5.0

2018-08-09 Thread vit via Digitalmars-d-announce
On Thursday, 9 August 2018 at 01:04:43 UTC, Paul Backus wrote: On Thursday, 9 August 2018 at 00:11:22 UTC, Seb wrote: On Thursday, 9 August 2018 at 00:07:05 UTC, Seb wrote: (It uses the version from DUB and updates itself once daily, but somehow dub still lists 0.4.1 at the moment) It looks

Re: sumtype 0.5.0

2018-08-09 Thread vit via Digitalmars-d-announce
On Thursday, 9 August 2018 at 01:04:43 UTC, Paul Backus wrote: ... @safe opAssign can call @system postblit: bool moved = false; struct S{ this(this)@system{ moved = true; } } void main()@safe{ auto st = SumType!(S).init; st = S.init; assert(moved == true); }

Re: sumtype 0.5.0

2018-08-09 Thread vit via Digitalmars-d-announce
On Thursday, 9 August 2018 at 01:04:43 UTC, Paul Backus wrote: On Thursday, 9 August 2018 at 00:11:22 UTC, Seb wrote: On Thursday, 9 August 2018 at 00:07:05 UTC, Seb wrote: (It uses the version from DUB and updates itself once daily, but somehow dub still lists 0.4.1 at the moment) It looks

Re: sumtype 0.5.0

2018-08-08 Thread Paul Backus via Digitalmars-d-announce
On Thursday, 9 August 2018 at 00:11:22 UTC, Seb wrote: On Thursday, 9 August 2018 at 00:07:05 UTC, Seb wrote: (It uses the version from DUB and updates itself once daily, but somehow dub still lists 0.4.1 at the moment) It looks like you didn't push the git tag to GitHub:

Re: sumtype 0.5.0

2018-08-08 Thread Seb via Digitalmars-d-announce
On Thursday, 9 August 2018 at 00:07:05 UTC, Seb wrote: (It uses the version from DUB and updates itself once daily, but somehow dub still lists 0.4.1 at the moment) It looks like you didn't push the git tag to GitHub: https://github.com/pbackus/sumtype/releases

Re: sumtype 0.5.0

2018-08-08 Thread Seb via Digitalmars-d-announce
On Wednesday, 8 August 2018 at 20:54:13 UTC, Paul Backus wrote: SumType is a generic sum type for modern D. It is meant as an alternative to `std.variant.Algebraic`. Features: - Pattern matching, including support for structural matching (*) - Self-referential types, using `This` -

Re: sumtype 0.5.0

2018-08-08 Thread Paul Backus via Digitalmars-d-announce
On Wednesday, 8 August 2018 at 21:57:07 UTC, vit wrote: Nice, but destructor SumType.~this() can call destroy on reference type like class: Whoops. Good catch. I've pushed a fix, tagged as version 0.5.1.

Re: sumtype 0.5.0

2018-08-08 Thread vit via Digitalmars-d-announce
On Wednesday, 8 August 2018 at 20:54:13 UTC, Paul Backus wrote: SumType is a generic sum type for modern D. It is meant as an alternative to `std.variant.Algebraic`. Features: - Pattern matching, including support for structural matching (*) - Self-referential types, using `This` -

sumtype 0.5.0

2018-08-08 Thread Paul Backus via Digitalmars-d-announce
SumType is a generic sum type for modern D. It is meant as an alternative to `std.variant.Algebraic`. Features: - Pattern matching, including support for structural matching (*) - Self-referential types, using `This` - Works with `pure`, `@safe`, `@nogc`, and `immutable` (*) - Zero