pipe and system building

Bert Freudenberg bert at freudenbergs.de
Fri Aug 31 02:29:26 UTC 2007


On Aug 30, 2007, at 2:57 , Fabio Filasieno wrote:

> On Aug 30, 2007, at 2:55 AM, Blake wrote:
>
>> On Wed, 29 Aug 2007 02:41:01 -0700, Fabio Filasieno  
>> <fabio.filasieno at gmail.com> wrote:
>>
>>>  From a first look at the collection libraries, it seems to me that
>>> there is a LOT of bloat. Really really a LOT.
>>> I bet that Ocaml's collections can do the same things with an order
>>> of magnitude of less of code.
>>
>> Easy enough to demonstrate, at least for starters. Show us a  
>> particularly bad example in Squeak and the same thing in OCaml.  
>> Then how you would recommend Smalltalk change. Stephen and his  
>> pals redesigned the whole collection system in traits to  
>> demonstrte their theory. (BTW, anyone know how to turn traits  
>> visible in the browser?)
>>
> I'll show the most evident thing
>
> add: newObject after: oldObject
> 	"Add the argument, newObject, as an element of the receiver. Put  
> it in
> 	the sequence just succeeding oldObject. Answer newObject."
> 	
> 	| index |
> 	index _ self find: oldObject.
> 	self insert: newObject before: index + 1.
> 	^newObject
>
> Why ? Why there is a NEED for this ? to save me 2 lines of code ?

No, because when I read

	foo bar.
	myColl add: baz after: fump.
	^zork

I find it infinitely more comprehensible than if I had to figure out  
what that index arithmetic actually means.

Also, it's an incarnation of the Once And Only Once principle.

Besides being polymorphic with the LinkedList implementation which  
does something completely different for obvious reasons.

I take Smalltalk's rich collection classes any day over the "lean and  
mean" collections elsewhere that make you implement all the boring  
index stuff over and over again.

- Bert -

PS: Btw, you don't earn too much respect here by insisting on arguing  
a topic to death. Actually contributing something useful is valued  
much higher.





More information about the Squeak-dev mailing list