Boost logo

Boost :

Subject: Re: [boost] xml?
From: Larry Evans (cppljevans_at_[hidden])
Date: 2010-04-09 13:23:09


On 04/09/10 12:10, Mathias Gaunard wrote:
> Larry Evans wrote:
>
>> I'm still not seeing it :( I thought algebraic data types were
>> one thing OO programming did well. For example, a stack is
>> and ADT and the stl library has a stack.
>
> ADT stands for Abstract Data Type.
> It's something else entirely.
>
> I suggest you take a look at wikipedia:
> <http://en.wikipedia.org/wiki/Algebraic_data_type>

OOPS. Sorry.

Yet the example shown on the wiki page looks like
an abstract syntax tree for which a class hierarchy
is entirely suitable. For example, each constructor
alternative in:

data Expression = Number Int
                 | Add Expression Expression
                 | Minus Expression
                 | Mult Expression Expression
                 | Divide Expression Expression

would be subclass of an abstract base class, Expression.

So, I'm "still" still not seeing the advantage of
a boost.variant over a type hierarchy.

-regards,
Larry


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk