[Issue 5085] New: std.variant.Algebraic name

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Oct 20 05:05:02 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=5085

           Summary: std.variant.Algebraic name
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: minor
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2010-10-20 05:04:21 PDT ---
Algebraic data types may be both product types and sum types:

>From Wikipedia:
http://en.wikipedia.org/wiki/Algebraic_data_types

> Special cases of algebraic types are product types i.e. tuples and
> records (only one constructor), sum types or tagged unions (many
> constructors with a single argument) and enumerated types (many
> constructors with no arguments). Algebraic types are one kind of
> composite type (i.e. a type formed by combining other types).


So std.typecons.Tuple too is an algebraic data type, it's a product type. The
data structure implemented by std.variant.Algebraic is just a special case of
algebraic data type, it's a sum type.

So it is better if the name of std.variant.Algebraic refers to 'sum type' or a
'tagged union' instead to generic data types.

So maybe "taggedUnion" is a more descriptive name of its purposes for
programmers of C-like languages.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list