[MC] Overrides and condenseChanges?

tim Rowledge tim at rowledge.org
Wed Apr 5 22:07:32 UTC 2006


On 5-Apr-06, at 2:09 PM, Andreas Raab wrote:

> tim Rowledge wrote:
>> Alternatively, it isn't some artifact of multibytefilethingummy  
>> writing the source in UTF-16 or whatever?
>
> Close. I found it. And I don't know how to say it gently but this  
> qualifies for the worst code I have *EVER* seen in Squeak

Well that seems a very good candidate for the original problem in  
condenseSources and certainly has a good chance of wining the  
'dreadfullest dreadful code' competition.

It doesn't however explain why your example snippet -
f1 := FileStream newFileNamed: 'f1.st'.
f2 := FileStream newFileNamed: 'f2.st'.
ExternalSettings fileOutOn: f1 moveSource: false toFile: 0.
ExternalSettings fileOutOn: f2 moveSource: true toFile: 1.
f1 close.
f2 close.
- was causing a problem. I found the answer to that though :-)

The clue was that the fileout code - untidy, ugly, poorly formatted  
though it be - is reasonably functional but somehow a completely  
strange set of source strings were getting written out in the f2  
case. What happens is that down a few levels from  
fileOutOn:moveSource:toFile: the list of categories is enumerated and  
each method in the cat is written out. When you reset the method  
source pointer we then set things up for the next problem.

Some classes have somehow ended up with a set of categories like
'--all--'
'private'
'accessing'
'--all--'
and that where the composting excrement impacts the rotating  
impeller. The first '--all--' that we see in a browser is an artifact  
and not really in the category list. The latter one is really there  
due to some ancient futzup that I have vague memories about from  
maybe 3.5ish time. So, we write out the methods in 'private' and  
update them. Then in 'accessing' and finally '--all--' which  
carefully includes all the selectors.... you can see where this is  
going, right? Now we have some methods with source pointers fairly  
randomly set into the file we're writing to but with incorrect  
fileIndex values since after all you were just doing an example. We  
write out each method with crapulated source and hey presto! A  
totally screwed file. Yippee.

Solution? Somebody can write a script to scan all classes and their  
metaclasses for categories explicitly called '--all--' and
a) move any methods actually, really, in the category (which you  
can't find by asking for the methods in '--all--' of course) to some  
where safe
b) deleting the stupid explicit '--all--' category.

Sigh.

tim
--
tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
Loyalty oaths.Secret searches.No-fly lists.Detention without legal  
recourse.Remind me - who won the cold war?





More information about the Squeak-dev mailing list