Boost logo

Boost :

Subject: Re: [boost] [variant] Maintainer
From: Louis Dionne (ldionne.2_at_[hidden])
Date: 2015-07-14 16:10:34


Larry Evans <cppljevans <at> suddenlink.net> writes:

>
> On 07/14/2015 11:16 AM, Nevin Liber wrote:
> > On 14 July 2015 at 08:01, Larry Evans <cppljevans <at> suddenlink.net> wrote:
> >
> >> What about variant<>, or is that disallowed?
> >> If it is disallowed, then tuple<> should, I guess, also be disallowed.
> >>
> >
> > Why?
> >
> [...]
>
> I know it that, at first glance, an empty product or empty coproduct
> doesn't make much sense, but, then again, adding 0 to a numerical
> sum doesn't make any difference; hence, why is there any need
> for 0? Apparently the category people think there's sufficient
> reason to define an empty coproduct and empty product; hence, I'd
> guess there's some good reason.
>
> Category experts (e.g. Louis Dionne), can you supply some better
> explanation?

Without false modesty, I can say that I am an absolute beginner in category
theory. So don't expect any clear cut answer from me. Bartosz Milewski
might be able to provide more insight, since he's been writing a book
about category theory for programmers.

That being said, I gathered my opinion on the mathematical aspect of the
thing into a short blog post at [1]. I'd like to emphasize that I'm only
looking at the problem from a mathematical perspective, disregarding
implementation issues or actual usefulness, because I haven't been
following the different variant discussions and proposals enough to
have a strong or valuable opinion.

TL;DR
-----
It should be a compilation error to create an object of type variant<>.

Also, seeing Peter Dimov's reply, it seems like the variant designers came
to the same conclusion.

Regards,
Louis

[1]: http://ldionne.com/2015/07/14/empty-variants-and-tuples/


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