ifNotNilDo: (was Re: [squeak-dev] SqueakMap in 4.1)

Levente Uzonyi leves at elte.hu
Mon Apr 12 16:26:37 UTC 2010


On Mon, 12 Apr 2010, Bert Freudenberg wrote:

> On 12.04.2010, at 00:27, Göran Krampe wrote:
>>
>> I have tried to maintain SM outside of the image earlier - but since the code sits in the image I understand that people start hacking on it. :) The effect is that there have been some changes to SMBase in trunk that only work in *later images*. For example, changing ifNotNilDo: to ifNotNil:. That does NOT work in Squeak 3.8 for example.
>>
>> So now I have backed out a few of these fixes so that the code still works in 3.8. For the moment - since I don't want to "disturb" the trunk way of things too much - just keep in mind that if you fix stuff in SMBase, the code is CURRENTLY meant to work in 3.8 and higher!
>
> I ran into exactly the same problem this weekend. Wanted to work on packetizing the Etoys image, using Karl's script as a start. But I got stuck when filing in recent Monticello versions gave a *syntax* error because ifNotNilDo: was replaced by ifNotNil:.
>
> I agree with you that some packages should be kept compatible with older image versions. In particular those packages that are necessary to upgrade older code bases.
>
> Does anyone have a snippet to find in a package all ifNotNil: sends that have a 1-argument block?

This should do it (without high-level tools):

| methods |
methods := (PackageInfo named: 'EToys') methods
 	collect: #compiledMethod
 	as: IdentitySet.
SystemNavigation default browseAllSelect: [ :method |
 	(methods includes: method) and: [
 		(method getSource asString reject: #isSeparator) includesSubString: 'ifNotNil:[:' ] ].

Comments may be a problem with this approach, but that's pretty unlikely 
to happen.


Levente

>
> - Bert -
>
>
>


More information about the Squeak-dev mailing list