On Tue, 9 May 2023 02:18:49 GMT, David Holmes <dhol...@openjdk.org> wrote:

>> My preference is to eventually make 'put' be 'put-ifwhen-absent', so I don't 
>> care which name you two pick.
>
> `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

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

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

Reply via email to