[squeak-dev] Preamble mess

Igor Stasenko siguctua at gmail.com
Mon Dec 21 23:45:26 UTC 2009


2009/12/22 Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>:
> 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. :)
>>
>
> Ah, thanks, it just explains the old code :)
> How to decline duplicating ? Is this a dupduplicate or a triplicate ?
> Anyway, don't use full names as your initials married with long method
> protocols, that might cross the 150 char boundary...
>
There was a fix buried somewhere in mailing list and fix, which uses
#priorChunk, or #backChunk,
which completely gets around this limitation.

> Nicolas
>
>> 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.
>>
>> 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.
>>
>>
>
>



-- 
Best regards,
Igor Stasenko AKA sig.



More information about the Squeak-dev mailing list