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 ;) End of rant :) Nicolas |
2009/12/22 Nicolas Cellier <[hidden email]>:
> 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. 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. |
2009/12/22 Igor Stasenko <[hidden email]>:
> 2009/12/22 Nicolas Cellier <[hidden email]>: >> 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... 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. > > |
2009/12/22 Nicolas Cellier <[hidden email]>:
> 2009/12/22 Igor Stasenko <[hidden email]>: >> 2009/12/22 Nicolas Cellier <[hidden email]>: >>> 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... > #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. |
2009/12/22 Igor Stasenko <[hidden email]>:
> 2009/12/22 Nicolas Cellier <[hidden email]>: >> 2009/12/22 Igor Stasenko <[hidden email]>: >>> 2009/12/22 Nicolas Cellier <[hidden email]>: >>>> 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. > #getPreambleFrom:at: is another variant that does not have the limitation... That's why I just removed (file position: (0 max: position - 150)) in two methods. But browsing for senders of #methodsFor: I can see more implementations, like ChangeRecord>>#prior PackageInfo>>#changeRecordForOverriddenMethod: So we get at least 5 copies of almost the same code (beside, a long one full of backward compatibility hacks...). Nicolas >> 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. > > |
In reply to this post by Igor Stasenko
2009/12/22 Igor Stasenko <[hidden email]>:
> 2009/12/22 Nicolas Cellier <[hidden email]>: >> 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. Nicolas > 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. > > |
2009/12/22 Nicolas Cellier <[hidden email]>:
> 2009/12/22 Igor Stasenko <[hidden email]>: >> 2009/12/22 Nicolas Cellier <[hidden email]>: >>> 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. > Actually i have better idea in mind, but implementing it could cost a lot of blood. :) - implement a class SourceCodeManager, which provides interfaces for reading/writing sources - redirect all sourcePointer-related stuff calls to it. - this class should not give away anything other than - source code #source - preamble #preamble and most of all, never, never let user code think that it deals with file handles. > Nicolas > >> 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. |
2009/12/22 Igor Stasenko <[hidden email]>:
> 2009/12/22 Nicolas Cellier <[hidden email]>: >> 2009/12/22 Igor Stasenko <[hidden email]>: >>> 2009/12/22 Nicolas Cellier <[hidden email]>: >>>> 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. >> > > Actually i have better idea in mind, but implementing it could cost a > lot of blood. :) > - implement a class SourceCodeManager, which provides interfaces for > reading/writing sources > - redirect all sourcePointer-related stuff calls to it. > - this class should not give away anything other than > - source code #source > - preamble #preamble > and most of all, never, never let user code think that it deals with > file handles. > OK, and also deal with opaque prior decoding... >> Nicolas >> >>> 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. > > |
>
> OK, and also deal with opaque prior decoding... > i am a dreamer.. normally such facility should just listen a SystemChangeNotifier, and blindly log all sources.. It should not interfere with classes/changesets etc. Classes should have no idea about 'logging'. They should just notify all interesting parties about new change. In theory we also should have a layered systemevent handling - before change - after change Currently a SystemChangeNotifier notifies about something which is already done, disrespecting those, who might want to prepare themselves for such change. Obviously, in case of SourceCodeManager, it should prepare a buffer with source code for writing, and precalculate a sourcePointer which new method should obtain, and pass this sourcePointer in form of trailer to the MethodNode, before new method could even have a chance to be created. And then if it receives a confirmation, that given change is successfully applied - write a source code to file (or anywhere it likes to). Of course, currently, this also could be done as a hack by simply making a postpone become-a-copy of method using #copyWithTrailerBytes: and placing the source pointer. -- Best regards, Igor Stasenko AKA sig. |
Free forum by Nabble | Edit this page |