Boost logo

Boost :

Subject: Re: [boost] Adding polymorphic_value to boost
From: Richard Hodges (hodges.r_at_[hidden])
Date: 2017-11-19 22:38:29


> From looking at the proposed implementation and one small sentence

I think it becomes a little clearer if you read the linked PR's motivation.

In a nutshell, it deduces and carries forward a type-erased copier, which
means you don't have to fiddle around with implementing a cloning strategy
on T or anything derived from it.

On 19 November 2017 at 22:31, Robert Ramey via Boost <boost_at_[hidden]>
wrote:

> On 11/16/17 1:14 AM, Jonathan Coe via Boost 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
>>
>> A working draft of the proposal and implementation can be found at
>> https://github.com/jbcoe/polymorphic_value
>>
>> I gave a presentation about polymorphic_value at C++::London here:
>> https://skillsmatter.com/skillscasts/9539-a-polymorphic-
>> value-type-for-c-plus-plus
>>
>> Matt Calabrese has kindly offered to be review manager.
>>
>> Kind regards,
>>
>> Jon
>>
>
> I looked over the github repo and the standards proposals. I also looked
> over the posts in this thread. I'm thinking the the enthusiasm is a little
> premature. Just some random observations which occurred to me as I looked
> this over.
>
> Explanation
> ===========
>
> From looking at the proposed implementation and one small sentence:
>
> "A polymorphic_value<T> may hold a an object of a class publicly derived
> from T"
>
> which suggests to me that certain operations such as assigment, copy,
> operators? etc. could be used with different instances created with
> different types all derived from type T. Sort of like a variant whose
> underlying types is that set of types derived from T. I don't know if I
> got this right - but reading the text and looking at the code, this is the
> impression I get.
>
> If I got it wrong, there are only really two possibilities:
>
> a) I'm stupid
> b) The explanation/motivation isn't rich enough.
>
> Just for the sake of argument, let's suppose that b) is the correct one.
>
> The motivating case seems to be usage as constituent of a composite
> object. But this seems to me totally unrelated to the interesting features
> of the "polymorphic value_type". I can't see why it's included or what it
> shows.
>
> So I would like to see some examples of problems that this would solve and
> how it would solve them. I would also like to see summary reference
> including valid expressions and type requirements on the type T parameter.
>
> Tests
> =====
> Looks OK - but I'd have to invest more effort to be sure.
>
> Source Code
> ===========
> OK - I'm nit picking here. I found the extensive usage of white space
> meant that I could only display about 20 lines of my code on my monitor. I
> would have found less blank lines and more {} added to other lines a big
> help in being able to read the code. I don't want for this to go on a
> tangent which ends up at the tabs/spaces cul-de-sac. So don't feel the need
> to respond to this.
>
> Soooooooo - In my humble opinion, this submission needs more work before
> it could seriously considered for review as a boost library.
>
> Robert Ramey
>
>
>
>
>
> _______________________________________________
> 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