[squeak-dev] The Trunk: Files-tpr.123.mcz

tim Rowledge tim at rowledge.org
Tue Jun 25 16:52:12 UTC 2013


On 22-06-2013, at 5:11 AM, Levente Uzonyi <leves at elte.hu> wrote:
> 
> If pathList is always an OrderedCollection (which is true), then #streamContents: is not needed. If it's always a new object (which is also true), then there's no need to copy it. So I think the following would be better:
> 
> pathParts
> 
> 	| pathList |
> 	pathList := super pathParts.
> 	(pathList at: 2 ifAbsent: [ nil ]) = '$' ifTrue: [
> 		pathList addFirst: pathList removeFirst, self slash, pathList removeFirst ].
> 	^pathList


That is certainly cleaner - but as you said *if* pathList is always an OC. The reason the older code had to cope with an Array is that it used to get an Array until someone changed it. This is a common problem that is quite hard to deal with, where users of a message need changing to match the implementation. We ought to be able to do better but it's hard. You could almost have some sympathy with the idea of specifying interfaces. Yuck.

tim
--
tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
Useful Latin Phrases:- Re vera, potas bene = Say, you sure are drinking a lot.




More information about the Squeak-dev mailing list