On Tue, 9 May 2023 13:49:55 GMT, Coleen Phillimore <cole...@openjdk.org> wrote:

>> `put_when_known_absent`? 
>> 
>> A basic `put` should either add or replace; a `put_if_absent` should only 
>> add else do nothing.
>
> put_when_absent is what I have and it's fine.  I don't think we need more 
> sentence names or changing doesn't materially improve this patch.  I was 
> comparing to the std::unordered_map class which we want to minimally emulate 
> and insert does insert if absent, so we shouldn't rewrite "put" to mean 
> put_if/when_absent, but the existing behavior was surprising and unexpected 
> to me.
> 
> https://en.cppreference.com/w/cpp/container/unordered_map/insert

Well ... many of our API's are more Java oriented in naming rather than C++ 
containers. And unordered_map does not strike me as something we even want to 
minimally emulate when it comes to method naming. YMMV.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/13818#discussion_r1190625824

Reply via email to