join

Keith Hodges keith_hodges at yahoo.co.uk
Tue Sep 19 23:21:57 UTC 2006


> I see it the other way, I have an array, I want a string, I ask the array to
> join: itself on some delimiter, it's the array's data, therefore the array
> needs to do the work.
>   
Ramon,

indeed I can see your point but have a look at the rest of the smalltalk 
system and look at how many things are implemented backwards to your way 
of thinking and how much more power and flexibility is available by 
doing things this way.

For example, using your logic, you would never come up with this idea.

1 to: 10 do: [:b ].

I think your version might look like something from another thread on 
squeak-dev at the moment. ACollection>>from:to:apply:

In this case Number>>to:do: is implemented on Number as syntactic sugar 
onto Interval>>do: which actually does the work.

I think that it is relatively common to have classes that are not the 
actual data holder doing the work. This is primarily because of the 
power of the Smalltalk collections and their iterators.

best regards

Keith


	
	
		
___________________________________________________________ 
All new Yahoo! Mail "The new Interface is stunning in its simplicity and ease of use." - PC Magazine 
http://uk.docs.yahoo.com/nowyoucan.html



More information about the Squeak-dev mailing list