Andrei Alexandrescu <> changed:

           What    |Removed                     |Added
             Status|NEW                         |RESOLVED
                 CC|                            |
         Resolution|                            |INVALID

--- Comment #2 from Andrei Alexandrescu <> 2010-10-21 
20:00:28 PDT ---
(In reply to comment #1)
> This is not the same as std.variant.Algebraic because:
> - There is no way for the programmer to read the tag, because the tag and its
> tests vanish in release mode.

This does not justify a new language feature. Anyone could define a private tag
that doesn't vanish in release mode.

> - Unions may have methods, they are quite more flexible than Algebraic.

A struct with an Algebraic member can define methods.

> - If you translate C code to D you may not want to modify too much the code, 
> so
> you will not use Algebraic. But you may add the @tagged attribute to unions
> translated from C. The size of the union changes, but hopefully this doesn't
> cause disasters often (if changing the size of the union is seen as not
> acceptable, then the union tags may be stored elsewhere on the heap and stack,
> but this may increase the implementation complexity of this feature).

Translation from C is hardly improved as use of union is rather rare.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to