Hard to find instance variables in Croquet.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Hard to find instance variables in Croquet.

askoh
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
Reply | Threaded
Open this post in threaded view
|

Re: Hard to find instance variables in Croquet.

John Dougan
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:

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
--
View this message in context: http://www.nabble.com/Hard-to-find-instance-variables-in-Croquet.-tp20808243p20808243.html
Sent from the Croquet - Dev mailing list archive at Nabble.com.




--
John Dougan
[hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Hard to find instance variables in Croquet.

askoh
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



John Dougan wrote
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 <askoh@askoh.com> wrote:

>
> 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
> --
> View this message in context:
> http://www.nabble.com/Hard-to-find-instance-variables-in-Croquet.-tp20808243p20808243.html
> Sent from the Croquet - Dev mailing list archive at Nabble.com.
>
>


--
John Dougan
jdougan@acm.org
Reply | Threaded
Open this post in threaded view
|

Re: Hard to find instance variables in Croquet.

askoh
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

John Dougan wrote
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 <askoh@askoh.com> wrote:

>
> 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
> --
> View this message in context:
> http://www.nabble.com/Hard-to-find-instance-variables-in-Croquet.-tp20808243p20808243.html
> Sent from the Croquet - Dev mailing list archive at Nabble.com.
>
>


--
John Dougan
jdougan@acm.org