Status: Accepted
Owner: stephane.ducasse
Labels: Milestone-1.3
New issue 3533 by stephane.ducasse: add Dictionary>>at:ifAbsentPutValue:
http://code.google.com/p/pharo/issues/detail?id=3533Igor suggests to add this method in dictionary to avoid to use block
closure when not necessary.
Here the block has to be passed and executed. When you know the value you
want to put this is extra work.
at: key ifAbsentPut: aBlock
"Return the value at the given key.
If key is not included in the receiver store the result
of evaluating aBlock as new value."
^ self at: key ifAbsent: [self at: key put: aBlock value]