Adding polymorphic_value to boost

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
65 messages Options
1234
Reply | Threaded
Open this post in threaded view
|

Adding polymorphic_value to boost

Boost - Dev mailing list
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

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Adding polymorphic_value to boost

Boost - Dev mailing list
On Thu, Nov 16, 2017 at 3:14 AM, Jonathan Coe via Boost <
[hidden email]> 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.
>

Not only do I want to see this put forth for review, but I'd also like to
see its review fast-tracked, since it's a target for standardization
currently being examined by LEWG.  There are a few of us in LEWG that want
to see essentially *all* novel library submissions do through Boost or
another widely-used library.  Mostly you can find these people on this
list. :)

This is why Boost was initially created, after all.  Whether it passes
review without change, gets rejected, or anything in between, the process
will be very informative to LEWG.

Zach

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Adding polymorphic_value to boost

Boost - Dev mailing list
On Fri, Nov 17, 2017 at 4:36 PM, Zach Laine via Boost <[hidden email]
> wrote:

>
> Not only do I want to see this put forth for review, but I'd also like to
> see its review fast-tracked, since it's a target for standardization
> currently being examined by LEWG.  There are a few of us in LEWG that want
> to see essentially *all* novel library submissions do through Boost or
> another widely-used library.  Mostly you can find these people on this
> list. :)
>
> This is why Boost was initially created, after all.  Whether it passes
> review without change, gets rejected, or anything in between, the process
> will be very informative to LEWG.
>

+1

--Beman

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Adding polymorphic_value to boost

Boost - Dev mailing list
In reply to this post by Boost - Dev mailing list


> -----Original Message-----
> From: Boost [mailto:[hidden email]] On Behalf Of Zach Laine via Boost
> Sent: 17 November 2017 21:37
> To: [hidden email]
> Cc: Zach Laine
> Subject: Re: [boost] Adding polymorphic_value to boost
>
> On Thu, Nov 16, 2017 at 3:14 AM, Jonathan Coe via Boost <
> [hidden email]> 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.
> >
>
> Not only do I want to see this put forth for review, but I'd also like to
> see its review fast-tracked,

+1

Paul



_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Adding polymorphic_value to boost

Boost - Dev mailing list
In reply to this post by Boost - Dev mailing list
On 11/18/17 00:36, Zach Laine via Boost wrote:

> On Thu, Nov 16, 2017 at 3:14 AM, Jonathan Coe via Boost <
> [hidden email]> 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.
>>
>
> Not only do I want to see this put forth for review, but I'd also like to
> see its review fast-tracked, since it's a target for standardization
> currently being examined by LEWG.

Not knowing anything about `polymorphic_value`, I welcome a new library
submitted for a review, but I don't see why the review should be
fast-tracked. Fast-tracked reviews are typically performed on something
that the community is very familiar with (not only the concept but the
implementation as well), which basically means it has to undergo a full
review first. That the library is also being reviewed by someone else
(e.g. LEWG) does not mean it has a free entry into Boost.

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Adding polymorphic_value to boost

Boost - Dev mailing list
On Sat, Nov 18, 2017 at 11:11 AM, Andrey Semashev via Boost <
[hidden email]> wrote:

> On 11/18/17 00:36, Zach Laine via Boost wrote:
>
>>
>> Not only do I want to see this put forth for review, but I'd also like to
>> see its review fast-tracked, since it's a target for standardization
>> currently being examined by LEWG.
>>
>
> Not knowing anything about `polymorphic_value`, I welcome a new library
> submitted for a review, but I don't see why the review should be
> fast-tracked. Fast-tracked reviews are typically performed on something
> that the community is very familiar with (not only the concept but the
> implementation as well), which basically means it has to undergo a full
> review first. That the library is also being reviewed by someone else (e.g.
> LEWG) does not mean it has a free entry into Boost.


 Agreed.  What I meant by fast-tracked wasn't that it should be reviewed
differently, but that the review should happen sooner.

Zach

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Adding polymorphic_value to boost

Boost - Dev mailing list
On Sat, Nov 18, 2017 at 10:29 AM, Zach Laine via Boost
<[hidden email]> wrote:
What I meant by fast-tracked wasn't that it should be reviewed
> differently, but that the review should happen sooner.

Let us be specific. Do you mean that the review should happen soon
enough that it has a chance of going in to Boost 1.67.0 if it passes?
Or 1.68.0?

Thanks

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Adding polymorphic_value to boost

Boost - Dev mailing list
In reply to this post by Boost - Dev mailing list
Le 16/11/2017 à 10:14, Jonathan Coe via Boost a écrit :

> 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.
>
Hi Jonathan,


I'll be all for having `polymorphic_value` in Boost so that we can play
with this class.

However, I would like to see also your original `cloning_ptr` and the
`propagate_const` and see how `polymorphic_value` can be built on top of
these classes. This will be the occasion to prove what you said in your
paper p0201r2 ;-)

Of course, we can review `polymorphic_value` independnetly of
`cloning_ptr` and the `propagate_const`.

"Design changes from cloned_ptr
The design of polymorphic_value is based upon cloned_ptr after advice
from LEWG. The authors would like to make LEWG explicitly aware of the
cost of these design changes.

polymorphic_value has value-like semantics: copies are deep and const is
propagated to the owned object. The first revision of this paper
presented cloned_ptr which had mixed pointer/value semantics: copies are
deep but const is not propagated to the owned object. polymorphic_value
can be built from cloned_ptr and propagate_const but there is no way to
remove const propagation from polymorphic_value.

As polymorphic_value is a value, dynamic_pointer_cast,
static_pointer_cast and const_pointer_cast are not provided. If a
polymorphic_value is constructed with a custom copier or deleter, then
there is no way for a user to implement the cast operations provided for
cloned_ptr.

[Should we be standardizing vocabulary types (optional, variant and
polymorphic_value) or components through which vocabulary types can be
trivially composed (propagate_const, cloned_ptr)?]"


Best,
Vicente

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Adding polymorphic_value to boost

Boost - Dev mailing list
In reply to this post by Boost - Dev mailing list
On Sat, Nov 18, 2017 at 1:12 PM, Vinnie Falco via Boost <
[hidden email]> wrote:

> On Sat, Nov 18, 2017 at 10:29 AM, Zach Laine via Boost
> <[hidden email]> wrote:
> What I meant by fast-tracked wasn't that it should be reviewed
> > differently, but that the review should happen sooner.
>
> Let us be specific. Do you mean that the review should happen soon
> enough that it has a chance of going in to Boost 1.67.0 if it passes?
> Or 1.68.0?
>

Let us be less specific.  Sometime in the next 3 to 9 months would be
timely enough for me (others, please feel free to correct me on this
range).  Just not the 2 years that some things have sat in the review queue.

Zach

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Adding polymorphic_value to boost

Boost - Dev mailing list
On Sun, Nov 19, 2017 at 1:46 PM, Zach Laine  wrote:
> Let us be less specific.  Sometime in the next 3 to 9 months would be
> timely enough for me (others, please feel free to correct me on this
> range).  Just not the 2 years that some things have sat in the review queue.

The review schedule is currently empty, so there's no obstacle to
having the review scheduled as soon as they want - even early as
December. As long as the review manager is on board, and the author
has communicated the period that they want to the review wizard, etc.

Glen

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Adding polymorphic_value to boost

Boost - Dev mailing list
In reply to this post by Boost - Dev mailing list
> Message: 10
> Date: Thu, 16 Nov 2017 02:14:30 -0700
> From: Jonathan Coe <[hidden email]>
> To: [hidden email]
> Cc: Matt Calabrese <[hidden email]>
> Subject: [boost] Adding polymorphic_value to boost
> Message-ID:
> <[hidden email]>
> Content-Type: text/plain; charset="UTF-8"
>
> 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
Hi,
I'd be interested in such a utility. Mathias Gaunard proposed something
similar on the mailing list a long while ago, I implemented a simple
version myself based on that.
I have a small number of questions. Given that this is a value type,
does the current approach over-expose pointer (ownership) in the
interface (in essence it still appears to be a glorified smart pointer)
and understate its more fundamental purpose as a regular value with
dynamic type? There might be other things which can usefully be added
for such a value type, for example permitting direct construction of an
object of specific (derived) type, by passing the type as well as the
arguments for the constructor of that type (or wrapping the arguments in
some kind of in-place factory with explicit type). Something like:

// Simple wrapper to enable a static type to be passed through a
forwarding constructor.
template <typename T>
struct Type {};

// Forwarding constructor - actual type is deduced from type wrapped in
(unnamed) first argument's type
template <typename D, typename... Args>
explicit poly_obj(Type<D>, Args&&... args);

// Also could have an emplace member function
template <typename D, typename... Args>
void emplace(Type<D>, Args&&... args);

In theory you wouldn't need to expose pointers in the interface at all?
In fact, should a type-erasure library be preferred (e.g.,
Boost.TypeErasure or Adobe.Poly) as it provides a more general solution
for manipulating polymorphic value types (though typically harder to use)?
Would you be considering supporting C++98 via using the boost::move library?

Regards,
Tom



_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Adding polymorphic_value to boost

Boost - Dev mailing list
In reply to this post by Boost - Dev mailing list
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
Reply | Threaded
Open this post in threaded view
|

Re: Adding polymorphic_value to boost

Boost - Dev mailing list

>Soooooooo - In my humble opinion, this submission needs more work before it
could seriously considered for review as a boost library.

To offer a quick alternative view, my immediate impression upon reading
p0201 paper, was "ah cool, someone's finally formalizing why I've used pImpl
for more than a decade" i.e. "value-izing" a polymorphic hierarchy. Making
things a value type is very useful - coping and moving just "do as the ints
do" and so make them easy to use in contexts like, yes, a class having two
polymorphic member variables. None of that yucky stuff about remembering not
to leak the first one when the second fails to clone... just two normal
member variables.

I'd like to see this in boost:: and then std::. Because unique_ptr is so
well digested by now, it feels right that this could be done relatively
quickly.

The only nit I had in the paper was that after all the banging on about it
being a value type, we are given operator bool, operator* and operator->,
making it pointer-like again. Could operator T& and operator T const& work?

Pete
 


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Adding polymorphic_value to boost

Boost - Dev mailing list
In reply to this post by Boost - Dev mailing list


> On 19 Nov 2017, at 21:31, Robert Ramey via Boost <[hidden email]> 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.
>

That’s pretty much right. For polymorphic_value there’s no facility for discovering the type like one might do for variant.

> 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
>
>

Thanks Robert,

that’s really helpful.
I definitely need to do some work on documentation with some more fleshed out usage examples.

I’ll happily reformat source to make it boost-ish. Is there a clang-format file that people (or maybe just you) tend to use?

Kind regards

Jon

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

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Adding polymorphic_value to boost

Boost - Dev mailing list
In reply to this post by Boost - Dev mailing list
> 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 <[hidden email]>
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
>

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Adding polymorphic_value to boost

Boost - Dev mailing list
On 11/19/17 2:38 PM, Richard Hodges via Boost wrote:
>>  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.

Hmmm - I'm pretty sure I read that.  On the paper I read, the third
section I read is: "Motivation: Composite objects".  That's the end of
it.  I guess that's OK for a standards proposal, but I think that Boost
users expect more complete motivation and justification.  Examples are
helpful here.  If it's better explained, one is likely to get more
people willing to review it - which is better all around.

BTW - our custom is bottom posting here.

Robert Ramey


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Adding polymorphic_value to boost

Boost - Dev mailing list
In reply to this post by Boost - Dev mailing list
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
>
> 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.

I endorse this submission provided that the repo submitted is organized
according to Boost standards with documentation in doc/, headers in
include/boost/, tests in test/. For examples of how a library directory
layout looks like, you can use small Boost libraries such as f.ex.
https://github.com/boostorg/assert (documentation in AsciiDoc) and
https://github.com/boostorg/align (documentation in QuickBook.)

I had a very similar thing (called ref<T> at the time), complete with the
copier and the deleter, many years ago that I never got around to proposing.
It seems to have been lost along with the Yahoo Boost group.

PS. The code is fine. There's no need to reformat it.


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Adding polymorphic_value to boost

Boost - Dev mailing list
In reply to this post by Boost - Dev mailing list
Peter Bartlett wrote:

> The only nit I had in the paper was that after all the banging on about it
> being a value type, we are given operator bool, operator* and operator->,
> making it pointer-like again. Could operator T& and operator T const&
> work?

Polymorphic means virtual functions, and when you have a
polymorphic_value<T> pv, where T has a virtual function `f`, you can call
`pv->f()`. With a conversion to T&, you can't call `pv.f()`.


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Adding polymorphic_value to boost

Boost - Dev mailing list
In reply to this post by Boost - Dev mailing list
On 11/19/17 2:34 PM, Jonathan Coe via Boost wrote:

>> 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
>>
>>
>
> Thanks Robert,
>
> that’s really helpful.
> I definitely need to do some work on documentation with some more fleshed out usage examples.
>
> I’ll happily reformat source to make it boost-ish. Is there a clang-format file that people (or maybe just you) tend to use?

LOL - I'm not going to suggest anything specific as that well get off
into the boost reality distortion field.  These are people who will
break up with their coder girlfriends over tabs vs spaces.

The general point is that you have to "sell" the library.  Bombast isn't
necessary (though it seems to work for Vinnie).  It has to slip in
really easily.  You look it over a little, get interested, and before
you realize it, you've consumed it.

FWIW - my presentation at CPPCon 2015 - How you can make a boost library
summarizes my views on the subject.  Bump the speed to save time.

https://www.youtube.com/watch?v=ACeNgqBKL7E

Also the boost library incubator may have some useful information.

The main thing to remember is that getting something accepted by Boost
is quite different than getting it accepted by the standards committee.

a) The boost process discourages stuff that no one is using
b) the boost process discourages stuff for which the use case isn't obvious.
c) The boost process is much, much faster than the committee process.
d) Both are seriously frustrating
e) Both are tedious - more work involved than one would think.  But the
committee process is even more dry and tedious.


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


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Adding polymorphic_value to boost

Boost - Dev mailing list
In reply to this post by Boost - Dev mailing list
On 20/11/2017 12:41, Peter Dimov wrote:

> Peter Bartlett wrote:
>
>> The only nit I had in the paper was that after all the banging on
>> about it being a value type, we are given operator bool, operator* and
>> operator->, making it pointer-like again. Could operator T& and
>> operator T const& work?
>
> Polymorphic means virtual functions, and when you have a
> polymorphic_value<T> pv, where T has a virtual function `f`, you can
> call `pv->f()`. With a conversion to T&, you can't call `pv.f()`.

You could pass it as a parameter to something that accepts a T& or T
const& and then make polymorphic calls from that, or alternatively
locally define a separate reference variable:

     Container<Base> c(new Derived);
     Base& r = c;
     r.f();  // calls Derived::f()

But yes, this is significantly messier (and more potentially surprising
to users) than using operator-> instead.

Additionally since polymorphic_value can be empty, retaining some
pointer-like syntax seems preferable as again this makes it less
surprising to consumers.


Although on a peripherally related note, this reminds me of a language
gripe I have with operator->, in that it is not used to resolve ->*
expressions.  This means that code such as (p->*f)(x) has to be changed
to (*p.*f)(x) if p is converted from a raw to a smart pointer, because
(almost) nobody ever implements operator->* explicitly.  (Although I
tried it as an experiment and it seems relatively straightforward to do
so in C++11, albeit at the cost of injecting std::function.)


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