Algebraic changing type when in associative array
rikki cattermole
rikki at cattermole.co.nz
Tue Feb 4 12:05:16 UTC 2020
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."
>>
>> https://dlang.org/phobos/std_variant.html#.Algebraic
>
> Okay, that makes sense. However, shouldn't it still be the same
> Algebraic type, and thus an alias for a VariantN with the same maximum
> size?
Algebraic doesn't exist. Its a name for your use.
This is what an alias is. It does not create a new type, it gives a name
to another one.
This chapter of the book (free) goes into more detail about alias
http://ddili.org/ders/d.en/alias.html
More information about the Digitalmars-d-learn
mailing list