Boost logo

Boost :

Subject: Re: [boost] Adding polymorphic_value to boost
From: Richard Hodges (hodges.r_at_[hidden])
Date: 2017-11-20 15:27:32


On 20 November 2017 at 16:09, Jonathan Coe via Boost <boost_at_[hidden]>
wrote:

>
>
> > On 20 Nov 2017, at 13:37, Peter Dimov via Boost <boost_at_[hidden]>
> wrote:
> >
> > Jonathan Coe wrote:
> >> I'd like to propose adding the class-template `polymorphic_value` to
> boost.
> >>
> >> `polymorphic_value` is designed to allow the compiler to correctly
> generate special member functions for classes with polymorphic components
> (It's `any` with an interface).
> >>
> >> `polymorphic_value` has been proposed for standardisation in P0201 and
> has advanced through the Library Evolution group in Albuquerque (Nov 5-10).
> https://wg21.link/p0201
> >
> > Has the name "polymorphic_value" been bike-shedded already?
> >
> > It's a good name in principle, but not good from a usability point of
> view; too long, too hard to type without errors in the absence of
> autocompletion.
> >
> > - poly_value?
> > - any_value?
> > - basic_any?
> >
> > Also,
> >
> > - poly
> >
> > seems to be popular, but it's probably too short.
> >
>
> The name has been bike-shedded.
> I agree it’s a little long but it conveys meaning pretty clearly to me.
>

As an opposing data-point I can offer my own experience. I was not
previously aware of the PR so the name polymorphic_value came to my
attention only yesterday.

My initial reaction to the name was to think, "oh, it must be some kind of
boost::any with some mechanism for providing operators - something I could
use as a polymorphic key in a map" - you know, a kind of value.

Clearly I was misled by the suffix _value.

It took two readings of the PR to finally understand that this was actually
a *pointer* with type-erased cloning.

There was no clue to that in the name at all - at least to me.

It seems to me that the previous name of cloned_ptr is a better choice.

But then I seem to find myself at odds with the thinking of committee
contributors more and more these days, so it's probably me.

R

>
> > _______________________________________________
> > Unsubscribe & other changes: http://lists.boost.org/
> mailman/listinfo.cgi/boost
>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/
> mailman/listinfo.cgi/boost
>


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