[self-interest] Keeping several versions around
bergel at iam.unibe.ch
Fri Jul 31 14:29:42 UTC 2009
I like the discussion you're having regarding modularity and system
extension. We had similar discussion in the Smalltalk World.
It will be a pleasure to participate in discussion and provide help if
necessary to have classboxes/changeboxes in Self.
> I'm lumping the Changebox stuff you refer to with their earlier
> Classbox stuff because keeping multiple versions of an object around
> is the same as keeping multiple implementations of compatible
> objects around - that is, versioning is really the same as
> The Classbox/Changebox etc stuff is a limited implementation of the
> type of stuff that 'Us' implemented: subjective, perspective based
> messaging systems (seehttp://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.56.7535)
> There isn't a publically available version of Us at the moment,
Yes, the work done on Us is very similar to what have been done with
> Niko Schwarz wrote:
>> I am interested in keeping several versions of code living side by
>> side in the same image. There is an implementation in Smalltalk, but
>> I'd like to know if this could be done more elegantly using Self.
>> The Smalltalk implementation is called Changeboxes,
>> http://scg.unibe.ch/archive/papers/Denk07cChangeboxes.pdf. It
>> essentially works by hooking into the compiler and then, upon every
>> method compilation, NOT pushing the Class onto the stack, but
>> rather a
>> level of indirection which finds the correct version of the class.
>> The idea is essentially the following. Imagine you just built a
>> feature, and it works, let's say you just implemented Exponentiation
>> using a while loop, that just multiplies a number with itself a given
>> number of times. It works. But you find it slow. Now, you fork, and
>> keep the old version around. You change the method, right there, you
>> don't make a new method, you CHANGE the old one. But still, you keep
>> the old one around.
>> And then you run them side by side. The currently active branch might
>> be the sped up algorithm, but you can still access the main trunk, so
>> now you benchmark the two, and see if they yield the same results:
>> [2 raisedTo: 100 ] timeToRunAndResult
>> [[2 raisedTo:100] inBranch: #main] timeToRunAndResult
>> So, how would you implement this version change with only little
>> performance penalty? How does the lookup process work anyway and how
>> can I hook into it?
>> All the best,
>> raisedToThe: anInteger
>> res := 1.
>> anInteger timesRepeat: [ res = res * self]
>> but it is slow. Now you fork, and keep the working version around,
>> both for examination
Alexandre Bergel http://www.bergel.eu
More information about the Self-interest