This makes sense, no? | dictionary | dictionary := WeakValueDictionary with: 'hello' -> nil copy. "Smalltalk garbageCollect." r:={ dictionary values includes: nil. dictionary at: 'hello'. dictionary at: 'hello' ifAbsent: [ 'absent' ]. dictionary at: 'hello' ifAbsentPut: [ 'put' ]. }. r and I get this anyway when GCing and puttting #x as value [image: Inline image 1] Maybe checking for emptiness first is needed before going for values include: Phil On Mon, Feb 20, 2017 at 11:18 PM, Martin Dias <tinchodias@gmail.com> wrote:
Hi. The answer of:
| dictionary | dictionary := WeakValueDictionary with: 'hello' -> 'world' copy. Smalltalk garbageCollect. { dictionary values includes: nil. dictionary at: 'hello'. dictionary at: 'hello' ifAbsent: [ 'absent' ]. dictionary at: 'hello' ifAbsentPut: [ 'put' ]. }
is:
#(true nil nil nil)
Bug or feature? shouldn't the value be considered as absent instead of present (and nil).
cheers, MartÃn