Re: Algebraic changing type when in associative array

2020-02-04 Thread Paul Backus via Digitalmars-d-learn
On Wednesday, 5 February 2020 at 01:06:46 UTC, rous wrote: This is an example program that illustrates the issue: import std.variant: Algebraic, This; import std.stdio: writeln; alias Foo = Algebraic!(This[], int); void main() { Foo x = 5; Foo y = 10; Foo z = [x,y]; pragma(msg,

Re: Algebraic changing type when in associative array

2020-02-04 Thread rous via Digitalmars-d-learn
On Tuesday, 4 February 2020 at 12:05:16 UTC, rikki cattermole wrote: On 05/02/2020 12:55 AM, rous wrote: On Tuesday, 4 February 2020 at 11:47:49 UTC, rikki cattermole wrote: It did not change type. "Algebraic data type restricted to a closed set of possible types. It's an alias for VariantN

Re: Algebraic changing type when in associative array

2020-02-04 Thread rikki cattermole via Digitalmars-d-learn
On 05/02/2020 2:11 AM, Paul Backus wrote: On Tuesday, 4 February 2020 at 11:45:50 UTC, rous wrote: I'm defining an Algebraic type like this: alias Expr = Algebraic!(This[char], string, int); However, when I create an Expr from an associative array of chars and Exprs, the Exprs seem to change

Re: Algebraic changing type when in associative array

2020-02-04 Thread Paul Backus via Digitalmars-d-learn
On Tuesday, 4 February 2020 at 11:45:50 UTC, rous wrote: I'm defining an Algebraic type like this: alias Expr = Algebraic!(This[char], string, int); However, when I create an Expr from an associative array of chars and Exprs, the Exprs seem to change from Algebraic to VariantN!32LU types. This

Re: Algebraic changing type when in associative array

2020-02-04 Thread rikki cattermole via Digitalmars-d-learn
On 05/02/2020 12:55 AM, rous wrote: On Tuesday, 4 February 2020 at 11:47:49 UTC, rikki cattermole wrote: It did not change type. "Algebraic data type restricted to a closed set of possible types. It's an alias for VariantN with an appropriately-constructed maximum size."

Re: Algebraic changing type when in associative array

2020-02-04 Thread rous via Digitalmars-d-learn
On Tuesday, 4 February 2020 at 11:47:49 UTC, rikki cattermole wrote: It did not change type. "Algebraic data type restricted to a closed set of possible types. It's an alias for VariantN with an appropriately-constructed maximum size." https://dlang.org/phobos/std_variant.html#.Algebraic

Algebraic changing type when in associative array

2020-02-04 Thread rous via Digitalmars-d-learn
I'm defining an Algebraic type like this: alias Expr = Algebraic!(This[char], string, int); However, when I create an Expr from an associative array of chars and Exprs, the Exprs seem to change from Algebraic to VariantN!32LU types. This is illustrated in the following error message: cannot

Re: Algebraic changing type when in associative array

2020-02-04 Thread rikki cattermole via Digitalmars-d-learn
It did not change type. "Algebraic data type restricted to a closed set of possible types. It's an alias for VariantN with an appropriately-constructed maximum size." https://dlang.org/phobos/std_variant.html#.Algebraic