Underscore conversion in 3.9 (was Re: About the #logChange error in SqueakMap)

Bert Freudenberg bert at impara.de
Wed Apr 5 11:59:09 UTC 2006


Am 31.03.2006 um 13:30 schrieb Bert Freudenberg:

> Am 31.03.2006 um 08:25 schrieb goran at krampe.se:
>
>> Ok, I sat down last night and spent a few hours (!) on getting SM  
>> into
>> shape for 3.9.
>> It turned out to be more work if doing it properly. [...]
>> unfortunately it contained [...]
>> tons of modifications caused by automatic conversion of underscore to
>> :=.
>>
>> Now - one question regarding that last part: Why did you replace  
>> *all*
>> underscores in the source with ":=" ?!? I saw at least one method in
>> which underscores *inside my String literals* had been replaced.  
>> Ouch.
>
> That shouldn't have happened, at least not with my automatic  
> conversion procedure, which carefully does not touch methods that  
> contain underscore in literals. I hope. Of course, when going over  
> the remaining methods manually these might have slipped in.

Oh well, turns out there actually *is* a bug in the conversion. It  
does not recognize literal underscores inside arrays :(

This snippet will find potentially broken methods (those that have a  
':=' inside a literal array):

SystemNavigation default browseAllSelect: [:meth |
	meth literals anySatisfy: [:lit | lit class == Array and: [
		| todo found |
		todo := OrderedCollection withAll: lit.
		found := false.
		[found or: [todo isEmpty]] whileFalse: [
			| next |
			next := todo removeFirst.
			next class == Array ifTrue: [todo addAll: next].
			found := next isString and: [next includesSubString: ':=']].
		found]]]

I have no fix yet, one would have to change  
MethodReference>>fixUnderscores to also look inside arrays. Or even  
better, use the Parser to recognize assignments and only replace  
those instead of all underscores in the source.

- Bert -




More information about the Squeak-dev mailing list