Administrator
|
There seem to be many instance variables in the class CPlayer that are not showing up in the debugger and 'show hierarchy'. Why? Is this a known bug or something special?
Aik-Siong Koh |
They're almost certainly not instance vars, but "fields". Fields are something like instance vars but they are represented in the myProperties dict in the CObject. If a field is not used it won't take up storage in the dict. Tweak uses a modified compiler that translates variable reference syntax into accessor message sends and creates accessors automatically so that the vars are never actually accessed directly.
So in Tweak: (assuming that foo is not a method temporary var) foo := self bar: 4 + 5. self foo: (self bar: 4 + 5). do pretty much the same thing in the bytecode. This is useful as it means that it's hard to accidentally bypass the event mechanisms in Tweak. If you browse a subclass of CObject and right click on one of the instance vars you'll see a pop up giving you the options for the var. The color/emphasis of the var name tells you what kind of var it is. Some description of the fields is at http://tweakproject.org/TECHNOLOGY/Tutorials/BankAccountTutorial/ and at http://tweakproject.org/tweak/tutorials/Tweak-Introduction.pdf Cheers, -- John On Tue, Dec 2, 2008 at 23:46, askoh <[hidden email]> wrote:
-- John Dougan [hidden email] |
Administrator
|
Thanks. When stepping through code with the debugger, do those "fields" behave correctly? How do I inspect their values in the debugger?
Aik-Siong Koh
|
Administrator
|
In reply to this post by John Dougan
Thanks. Are "fields" implemented anywhere else? I see myProperties in TObject, but it doesn't have "fields" there. How does TObject use myProperties differently? Would it be wise to use "fields" in TObject too?
All the best, Aik-Siong Koh
|
Free forum by Nabble | Edit this page |