[squeak-dev] Dictionary >> #at:ifAbsentPut:ifPresentPut:

stlutz dev at stlutz.net
Fri Apr 30 23:26:38 UTC 2021


Christoph Thiede wrote
> What do you think, should we copy this into the Trunk?

Personally, I'd get good use out of at:ifPresentPut: and
at:ifPresentPut:ifAbsentPut:.
I seriously considered adding them as extensions in a couple of projects.

Christoph Thiede wrote
> Also, I'm not sure about the order of arguments.

The pattern other selectors in Squeak follow is present first, absent
second.
We should probably keep to that pattern.

Tobias Pape wrote
> I find it a bit too specific for trunk.
> It's quite an edge case...

FWIW I encountered this case quite a few times over the years.
It's essentially always a concern when storing and updating value objects in
dictionaries.

Levente Uzonyi wrote
> If wanted to have a special method for that case, I would try to look up
> the key only once.

+1

Stephan



--
Sent from: http://forum.world.st/Squeak-Dev-f45488.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20210430/1488e1c7/attachment.html>


More information about the Squeak-dev mailing list