[squeak-dev] Re: Ideas about sets and dictionaries

Levente Uzonyi leves at elte.hu
Tue Nov 17 14:05:26 UTC 2009


On Tue, 17 Nov 2009, Igor Stasenko wrote:

> i introduced a new #like:ifAbsent: method, so #like: just using it by
> providing a default block for absent case.
> As you can conclude, we need a more generic #like:ifAbsent: since
> #like: originally returns nil if object not in set, but since nils now
> can be included in set, it is more recommended to use like:ifAbsent: .

I agree, #like:ifAbsent: is a must. I don't know any use of Set >> #like:, 
but there may be packages which use this method. The only reason we should 
keep it is for backwards compatibility with these possible packages.

> Btw, if you take a look on a single, real usage of #like:
> Symbol class>>hasInterned: aString ifTrue: symBlock
> you can see that it could be optimized to use a new message, and
> completely eliminate an introduced slowdown of extra block activation.
>

Symbols are stored in WeakSets and AFAIK those aren't changed yet here: 
http://bugs.squeak.org/file_download.php?file_id=3829&type=bug

Levente

>
>
> -- 
> Best regards,
> Igor Stasenko AKA sig.
>
>



More information about the Squeak-dev mailing list