sorry, it should be SmallInteger class >> initialize self addInstVarName: 'Zaraza'. Notice I want to add a class variable to SmallIneteger, not instVar. Cheers mariano On Mon, Dec 13, 2010 at 9:16 PM, Mariano Martinez Peck <[hidden email]> wrote: Hi folks. Sorry for the cross-post, I am not sure if it is image or vm problem. |
On 13.12.2010, at 13:06, Mariano Martinez Peck wrote: sorry, it should be This is not really a VM question. Class variables are held in a dictionary. The VM knows nothing about this. You add class variables simply by adding them to the class pool: SmallInteger ensureClassPool. SmallInteger classPool at: #Zaraza put: 42. - Bert - |
On 12/13/2010 2:48 PM, Bert Freudenberg wrote: > On 13.12.2010, at 13:06, Mariano Martinez Peck wrote: > >> sorry, it should be >> >> SmallInteger class >> initialize >> self addInstVarName: 'Zaraza'. >> >> Notice I want to add a class variable to SmallIneteger, not instVar. > > This is not really a VM question. Class variables are held in a > dictionary. The VM knows nothing about this. And of course class vars are added by using #addClassVarName: not #addInstVarName:. Cheers, - Andreas |
On 14 December 2010 00:13, Andreas Raab <[hidden email]> wrote: > > On 12/13/2010 2:48 PM, Bert Freudenberg wrote: >> >> On 13.12.2010, at 13:06, Mariano Martinez Peck wrote: >> >>> sorry, it should be >>> >>> SmallInteger class >> initialize >>> self addInstVarName: 'Zaraza'. >>> 'Zaraza' in russian means 'infection'. It also used for swearing, when something goes not what expected to be :) >>> Notice I want to add a class variable to SmallIneteger, not instVar. >> >> This is not really a VM question. Class variables are held in a >> dictionary. The VM knows nothing about this. > > And of course class vars are added by using #addClassVarName: not > #addInstVarName:. > class inst var should be ok too. Not sure what the correct message for adding it programmatically. > Cheers, > - Andreas > -- Best regards, Igor Stasenko AKA sig. |
On 12/14/2010 1:09 AM, Igor Stasenko wrote: >>>> Notice I want to add a class variable to SmallIneteger, not instVar. >>> >>> This is not really a VM question. Class variables are held in a >>> dictionary. The VM knows nothing about this. >> >> And of course class vars are added by using #addClassVarName: not >> #addInstVarName:. >> > > class inst var should be ok too. Not sure what the correct message for > adding it programmatically. Obviously that would be "self ->class<- addInstVarName: 'classInstVarName'". BTW, you do realize that you can try all of this right in the browser, no? All you need is to go to class SmallInteger and edit the class definition. Then you can see whether it is possible to add instance variables (it's not), class variables (works fine), or class instance variables (works fine, too). And once you've tried this it should be pretty obvious that your code is broken and not the VM and/or ClassBuilder. Cheers, - Andreas |
On Tue, Dec 14, 2010 at 10:18 AM, Andreas Raab <[hidden email]> wrote:
Yep....sorry. Conclusion: do not program while building the christmas tree with your wife ;) BTW, you do realize that you can try all of this right in the browser, no? All you need is to go to class SmallInteger and edit the class definition. Then you can see whether it is possible to add instance variables (it's not), class variables (works fine), or class instance variables (works fine, too). And once you've tried this it should be pretty obvious that your code is broken and not the VM and/or ClassBuilder. yes, that a good tip. Thanks
|
In reply to this post by Bert Freudenberg
On Mon, Dec 13, 2010 at 11:48 PM, Bert Freudenberg <[hidden email]> wrote:
Ok, perfect. I asked because once I was doing some proxies for Classes and I realized that the VM automatically access the offset of the Class instVar like methodDict, etc. I thought that maybe at some place the same could happen with SmallInteger class. Thanks Mariano
|
Free forum by Nabble | Edit this page |