Truly algebraic Variant and Nullable
9il
ilyayaroshenko at gmail.com
Tue Dec 22 03:56:13 UTC 2020
On Sunday, 20 December 2020 at 11:00:05 UTC, Tobias Pankrath
wrote:
> On Sunday, 15 November 2020 at 04:54:19 UTC, 9il wrote:
>> Truly algebraic Variant and Nullable with an order-independent
>> list of types.
>
> Thanks for sharing it!
>
> Could you give a (very short) explanation on why sumtype could
> not meet your requirements? I am just starting a new D project
> and have to choose between sumtype and your solution.
>
Lets users do comparisons between libraries. Both are very good.
Some mir.algebraic features:
1. (optionally) Nullable algebraic types. Also serves as buggy
Phobos Nullable replacement.
2. (optionally) Tagged algebraic types
3. Type list order-independent declaration
4. Feature-rich visitor handlers. For example, they can form new
Algebraic types if the visitors return different types.
5. `void` support. This is an important brick for reflections on
the algebra of type sets.
6. Algebraic type subsets are supported by `get`, `trustedGet`,
`_is`, and `this` primitives. You can operate with algebraic
subset as with the type of the original typeset. [1]
7. Members (fields and methods) reflection. Is more restrictive
than in vibe.d implementation. It adds member reflection to an
algebraic type if all of the types contain members with the same
name.
Mir implements Algebra of (type) sets with reflections
(functions) on it.
[1] https://github.com/libmir/mir-core/issues/33
More information about the Digitalmars-d-announce
mailing list