[squeak-dev] WeakIdentityDictionary vs WeakSet

St├ęphane Rollandin lecteur at zogotounga.net
Sat Jul 23 13:01:15 UTC 2022


Hello all,

I noticed that a WeakIdentityDictionary does not hold literal values.
For example, in a workspace:

	wd := WeakIdentityDictionary new.
	wd at: #foo put: 42.
	wd at: #bar put: #foo.

	wd "printIt ->"  a WeakIdentityDictionary()

On the other hand, WeakSet does hold literals

	ws := WeakSet new.
	ws add: #foo.
	ws add: 42.

	ws "printIt ->" a WeakSet(#foo 42)

And also WeakKeyDictionary

	wk := WeakKeyDictionary new.
	wk at: #foo put: 42.
	wk at: #bar put: #foo.

	wk "printIt ->"  a WeakKeyDictionary(#bar->#foo #foo->42 )


Is this the intended behavior? What is the semantics here?

Stef


More information about the Squeak-dev mailing list