Tips and tricks?

Romain Robbes rrobbes at info.unicaen.fr
Wed Mar 10 15:38:47 UTC 2004


Hi stef,

Would the AddInstanceVariableRefactoring solve your
problem ?
Just wondering ...

	Romain


Le 9 mars 04, à 22:22, ducasse a écrit :

> Hi andreas
>
> We never had the time to look at it deeply but we discussed with alex 
> a lot. But I was really thinking that the model of smalltalk is really 
> powerful with class extensions (AspectJ introductions are a simple 
> proof of that) then on the hand of the state we are weak
> because we have to do all kind of hack.
>
> In VW I happen to copy and paste the code of the class and add the 
> instance variable but again this is a hack
> because I know that the parcel support that even if store is shaky 
> about it. and sometimes is confused. Again a hack
>
> In fact I would like to say:
>
> Object subclass:
> 	addIV: 'x'
>
> and not
> 	iv: ' a c x'
>
> Now the question is the question of the offset in the compiled 
> methods. This is clear that with only using accessor
> we could get rid of that as they do in DrScheme or Unit. But we need 
> speed.
> So does anybody know:
> 	- would it be possible with offset (my impression is that this cannot 
> work)
> 	- in which special case this does not work and what would be the 
> purcentage.
> I think that this is area where smalltalk would gain to be improved.
>
> Stef
>
> On 9 mars 04, at 21:04, Andreas Raab wrote:
>
>>> Nu, so what was the trick?
>>
>> Q: Say you have an extension in some class which requires an extra 
>> class
>> variable. How would you get that class variable into a system, given 
>> that MC
>> doesn't really track such changes?
>>
>> A: You make a class side #initialize methods which looks like:
>>
>> Foo class>>initialize
>>     "Make sure that the class variable is present"
>>     (self classPool includesKey: #MyVariable) ifFalse:[
>>         self addClassVar: #MyVariable.
>>     ].
>>     MyVariable := 42.
>>
>> Cheers,
>>   - Andreas
>>
>>
>>
>
>
>




More information about the Squeak-dev mailing list