On 31 December 2016 at 18:47, Nicol Bolas <
jmck...@gmail.com> wrote:
> LWG 2089 is a library issue about `emplace`-style functions not being able
> to perform aggregate initialization. While it is expressed specifically for
> `allocator::construct`, new C++ changes (the deprecation of
> `allocator::construct`, `make_shared/unique`, the `in_place_t` constructors
> for `any` et. al) would suggest that any appropriate fix be applied
> elsewhere too.
>
> The issue itself is still active. It has the status "EWG", due to wanting to
> investigate whether Evolution would like to pursue a language-based solution
> to such initialization issues (ie: asking if EWG is OK with the library
> essentially creating a new form of initialization).
>
> This was presented in N4462 at Lexana, apparently. The EWG issue, #185, is
> set to the status "Ready", with the comment that EWG is fine with this being
> a library-based solution. That was in mid-2015.
>
> So... now what? The LWG issue seems to be waiting for EWG, which made their
> decision back in 2015. And yet, nothing has gone anywhere. Is the issue
> moving forward?
Well, first of all, "The notes in Lenexa say that Marshall & Jonathan
volunteered to write a paper on this".
Marshall and Jonathan have been far too busy with other things, so I'm
not expecting anything
in this area for C++17. Beyond that, the problem needs further work.
> I bring this up in part because I think LWG 2089 is flawed. Or more to the
> point, I would rather it be restricted specifically to aggregate
> initialization.
The general problem is that it's impossible for a wrapper to convey
initialization really-perfectly.
Currently, a wrapper like make_unique has to make a decision - whether
to paren-init or whether
to brace-init, because that still can make a difference. N4462
explores potential solutions, but
doesn't nail down any particular one.
> I think it would be best that, if you want an `initializer_list`
> constructor, you always have to spell it out. It makes it much more clear to
But that's not the problem. If you have an initializer_list
constructor, you can give an initializer_list
to a wrapper and it *can* forward it(*). But what the wrapper can't do
is know whether your
target type to be wrapped can or cannot be paren-initialized, or
whether that target type
*requires* brace-init. Like aggregates do.
(*) Well, ok, unicorn initialization and imperfect forwarding can't
know that your potential
braced-list is meant to be an initializer_list.
> Essentially, I say that LWG 2089 should be exclusively about adding
> aggregate initialization support to indirect forms of initialization (my
> term for all kinds of `emplace`-like behavior). It should be explicitly
> restricted from invoking list-initialization for non-aggregates. Of course,
> doing that in the library would require an `is_aggregate<T>` trait. But
> quite frankly, we've needed that trait for some time now.
We have? Where? Evidence, please? Note: I'm not outright claiming that
we couldn't
*use* such a trait in some cases. I'm asking what evidence supports such a trait
and makes it the *correct* solution to the problem space of LWG 2089 and N4462.
In order to make substantiated claims about any of it, I
(want/need/)demand to see
- an implementation of the solution, whatever it is
- some findings on what its impact on an existing testsuite is
- preferably some findings on what its impact on non-testsuite code is.
Prior to that, all talk is cheap. The reason why I, Marshall nor
Jonathan haven't tried to slam-dunk
anything towards LEWG yet is that we have none of the above.
Regardless of "who the f*** are you",
Marshall and Jonathan are stdlib maintainers, and wrt "who the f*** am
I", I wouldn't let any solution
in this problem space anywhere near C++ without doing the homework
mentioned above.
The reason being that the initialization rules, and library facilities
above, wrapping and accommodating
them were in a state of flux to the very end of standardizing C++11.
To change something in this
area *requires* care. We have existing users relying on the current
rules, sane or not (both the users
and the rules), and changing them requires rationale, motivation,
proof-of-concept and testing.
I am, Yours Most Sincerely,
Ville Voutilainen,
The Chair of The Evolution Working Group