Idea for a possibly better Collection occurrencesOf method.

Klaus D. Witzel klaus.witzel at cobss.com
Tue Sep 12 11:33:43 UTC 2006


On Tue, 12 Sep 2006 13:12:23 +0200, J J wrote:

> I misspelled "slower" (was thinking rolling and typing slower. :) ).

Ah, back in sync again (that's what I expected :)

> The point is, if using the library is noticably slower then just rolling  
> your own then
> some people will always use there own.
> Look at C++ for an example of what I mean.
...
> Why?  Performance.
...
> you will end up writing a bunch of stupid conversion functions to all  
> these types.

Yes, as you said: lack of reuse(able code).

> I know we are just talking about 2 methods here,

... at the heart of the implementation of sets (like: numbers, magnitudes,  
etc) in Smalltalk ...

> but it's a bad president to set.  Would the
> implimentation Jon mentioned work,

100%[tm] perfect. This a typical Smalltalk solution. For an analogous  
concept have a look at what the VM does with #at: and #at:put: (I mean the  
atPutCache).

> or what are the bad points?

Zero (IMHO) iff (!) we'd write comments on why and how this new  
#apply:from:to: must be as it is ;-)

> The debugger wouldn't let
> you walk the code then or?

Zero impact: the VM, when executing the #apply:from:to: primitive, will  
send messages to your "do:" block and the debugger is (can be, dependent  
on the implementation) in full control. Of course one can no longer change  
the from and to arguments in the debugger, but: I could not care less 8-)

/Klaus

> Thanks




More information about the Squeak-dev mailing list