On 4/10/18 12:59 PM, Paul Backus wrote:
On Tuesday, 10 April 2018 at 12:34:07 UTC, aliak wrote:
Awesome!
this is a neat trick:
union
{
AliasSeq!(T0, T1) values;
}
Is that usage documented somewhere, or is it somewhere in phobos maybe?
Also, can Algebraic be fully replaced with this
On Tuesday, 10 April 2018 at 12:34:07 UTC, aliak wrote:
Awesome!
this is a neat trick:
union
{
AliasSeq!(T0, T1) values;
}
Is that usage documented somewhere, or is it somewhere in
phobos maybe?
Also, can Algebraic be fully replaced with this version then or
is there some functionality
On Tuesday, 10 April 2018 at 03:48:25 UTC, Paul Backus wrote:
Nope! It's just a tagged union, almost exactly the same as what
you'd write by hand in C. You can take a look at the source
yourself, if you're curious---it's actually pretty simple:
On Tuesday, 10 April 2018 at 00:22:18 UTC, helxi wrote:
On Monday, 9 April 2018 at 15:59:32 UTC, Paul Backus wrote:
On Monday, 9 April 2018 at 07:07:58 UTC, Chris Katko wrote:
[...]
I agree in general, but in this case it's actually completely
doable. In fact, I've done it myself: check out
On Monday, 9 April 2018 at 15:59:32 UTC, Paul Backus wrote:
On Monday, 9 April 2018 at 07:07:58 UTC, Chris Katko wrote:
[...]
I agree in general, but in this case it's actually completely
doable. In fact, I've done it myself: check out 'sumtype' on
code.dlang.org. You can replace
On Monday, 9 April 2018 at 07:07:58 UTC, Chris Katko wrote:
On Monday, 9 April 2018 at 07:02:50 UTC, Hasen Judy wrote:
IMO, this is one more reason why sum-types should be built
into the language compiler, instead of being implemented in
user-space.
+1. Any time you have to "create" a
On Monday, 9 April 2018 at 03:20:58 UTC, helxi wrote:
Is std.variant.visit not @nogc?
These error messages REALLY need to be fixed.
visit, being a template, is @nogc or not based on the arguments
passed to it as well as its own body, so while the error messages
point to visit itself
);
}
}
Complains source/app.d(18,19): Error: @nogc function D main
cannot call non-@nogc function std.variant.visit!(function
(string s) => printf("%s\x0a", cast(immutable(char)*)s), function
(int n) => printf("%i\x0a", n)).visit!(VariantN!(16LU, int,
string)).visi