[squeak-dev] Preamble mess

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Mon Dec 21 23:57:43 UTC 2009

2009/12/22 Igor Stasenko <siguctua at gmail.com>:
> 2009/12/22 Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>:
>> Can someone justify why the first sentence would be needed at all:
>>    file position: (0 max: position-150).
>>    preamble := method getPreambleFrom: file at: (0 max: position - 3).
>> in ChangeSet>>#scanVersionsOf:class:meta:category:selector:
>> and in VersionsBrowser>>#scanVersionsOf:class:meta:category:selector:
>> My guess is no-one given that the first thing #getPreamble:at: will do
>> with the file is
>>    file position: (0 max: position - 3).
>> Just the kind of code I spend too many time on, trying to figure what
>> I did not understand when there is nothing to understand but code is
>> dead...
>> While at it, also explain me why so much code is duplicated in Squeak ;)
> Hehe, you forgot
> MCMethodDefinition>>scanForPreviousVersion
> which is almost identical to the above ones, except some minor changes.
> I just stared at same method(s) couple hours ago. :)
> The way how VersionBrowser detects an older versions of method is
> total mystery to me.
> I doubt that it scans the whole .changes and .sources files, otherwise
> it wouldn't be so fast,
> or i underestimated the squeak's file handling speed :)
> Oh wait, i think i understood a bit.
> it looks for a #methodsFor: prior:  pattern
> and by reading a value of prior: argument it knows where to look
> further in chain.
> What i would do, if i would be cleaning up this mess, is to change ALL
> sourcePointers to point at the beginning
> of the method's stamp, instead of pointer to the beginning of method source.
> Then, reader could easily read a method stamp/preamble
> #nextChunk
> and its source
> #nextChunk
> and no more black voodoo rewinding the stream back by a 150 ... to
> figure out the preamble.

Good idea, but we would have to change not only source position of
every method but also prior indication written on each time stamp...
I guess a condenseChanges would be the most simple thing to do if
you'd go for such a change.


> And of course, i'm itching to make source pointer to be an arbitrary
> integer value - because new method trailers
> support that ;)
>> End of rant :)
>> Nicolas
> --
> Best regards,
> Igor Stasenko AKA sig.

More information about the Squeak-dev mailing list