Subject: [boost] Variant and visitation (was: [optional] Safe optional)
From: Nevin Liber (nevin_at_[hidden])
Date: 2014-11-18 16:40:37
On 18 November 2014 15:02, Matt Calabrese <rivorus_at_[hidden]> wrote:
> > > For a while I assumed exactly that, but he actually specifically voiced
> > > that he does not like visitation on variant and thinks of it as a hack.
> > > It's sad :/
> > >
> > FWIW: I think he is (a) correct, but (b) we have nothing better to
> > it, so we still need it.
> We should really start a thread about this. I'm very curious to see an
> actual objective rationale both for why visitation over a closed set of
> types known at compile time is in any way a "hack,"
It's the inversion of control that people just don't like.
> along with a realistic
As I already said, I don't know of one, and having it is better than not
The discussion in Urbana on n4218
(variant), which didn't propose visitation, basically amounted to we don't
like visitation but we need it unless something better comes along.
> It really is a fundamental operation of a discriminated union.
> As someone who uses variants pretty much as the "default" for run-time
> polymorphism in day-to-day coding, I have never seen an actual explanation
> for what someone might consider bad about variant visitation, neither from
> Bjarne nor anyone else.
While I don't want to speak for Bjarne, I believe he would rather have some
form of Pattern Matching <http://www.stroustrup.com/OpenPatternMatching.pdf>
and possibly variant as a language feature. That being said, no one has
-- Nevin ":-)" Liber <mailto:nevin_at_[hidden]> (847) 691-1404