ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> boost
boost
[boost] Re: Proposal --- A type-safe union
by Andrei Alexandrescu other posts by this author
Jun 11 2002 10:43PM messages near this date
Re: [boost] Proposal --- A type-safe union | RE: [boost] Postfix Increment Operator
"Esa Pulkkinen" <esa.pulkkinen@[...].net>  wrote in message
news:200206111802.g5BI2YT06869@[...]..
>  Also, the visitor pattern is actually exactly the same as 'fold' is in
>  functional languages, which is very closely related to unions.  The
>  corresponding inverse operation ("unfold") is also something I think
>  should be remembered [a way to think of it is that 'visitor' (fold)
>  reads (or destroys if you believe in functional languages) information
>  from a data structure based on an algorithm and the unfold will
>  construct such data structure based on an algorithm.]. In particular,
>  using a visitor in conjunction with an 'unfold' operation will allow you
>  to translate between any two variant data structures that have
>  isomorphic structure.

That's indeed true (and cool). The corresponding version of "unfold" when
translated in industrialish/pattern lingo, is Factory. That is, you create
discriminated unions using a factory, and you uncloak their type by
visiting.

I wanted to write more about the connection between factories and
discriminated unions in my last installment treating Variant, but there was
no space. Anyway, the third and last article on Variant, together with
complete source code, will be soon available from
http://cuj.com/experts/2008/alexandr.htm.


Andrei




_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Thread:
Itay Maman
Fernando Cacciola
Douglas Gregor
Fernando Cacciola
Andrei Alexandrescu
David B. Held
Itay Maman
Douglas Gregor
Andrei Alexandrescu
Itay Maman
Douglas Gregor
Fernando Cacciola
Douglas Gregor
Fernando Cacciola
Andrei Alexandrescu
Fernando Cacciola
Itay Maman
Douglas Gregor
Fernando Cacciola
Douglas Gregor
Douglas Gregor
Esa Pulkkinen
Andrei Alexandrescu

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved