classVariableNames

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

classVariableNames

Dan Corneanu
Hi,
how can I inspect the TTFontDescription's class variable named
'Descriptions' ?

Reply | Threaded
Open this post in threaded view
|

Re: classVariableNames

Tom Phoenix
On 3/8/06, Corneanu Dan <[hidden email]> wrote:

> how can I inspect the TTFontDescription's class variable named
> 'Descriptions' ?

This expression lets you "inspect it":

    (TTFontDescription bindingOf: #Descriptions) value

Hope this helps!

--Tom Phoenix

Reply | Threaded
Open this post in threaded view
|

Re: classVariableNames

Hans-Martin Mosner
Tom Phoenix wrote:

>On 3/8/06, Corneanu Dan <[hidden email]> wrote:
>
>  
>
>>how can I inspect the TTFontDescription's class variable named
>>'Descriptions' ?
>>    
>>
>
>This expression lets you "inspect it":
>
>    (TTFontDescription bindingOf: #Descriptions) value
>
>Hope this helps!
>
>--Tom Phoenix
>
>
>  
>
Or you can select the class var name in the browser while showing the
class definition, and then use the 'inspect it' menu choice.
(when a class is selected in the browser, its scope is available to code
executed in the text pane.)

Cheers,
Hans-Martin

PS: Thanks for looking at this problem in Mantis! I will probably have a
look at it again sometime later, but at the moment I don't have enough
time to investigate.

Reply | Threaded
Open this post in threaded view
|

RE: classVariableNames

Ron Teitelbaum
> From: Hans-Martin Mosner
> Sent: Wednesday, March 08, 2006 5:31 PM

> >Tom Phoenix wrote:
>
> >>On 3/8/06, Corneanu Dan <[hidden email]> wrote:
> >>how can I inspect the TTFontDescription's class variable named
> >>'Descriptions' ?
> >
> >This expression lets you "inspect it":
> >    (TTFontDescription bindingOf: #Descriptions) value
> >Hope this helps!
> >--Tom Phoenix

> Or you can select the class var name in the browser while showing the
> class definition, and then use the 'inspect it' menu choice.
> (when a class is selected in the browser, its scope is available to code
> executed in the text pane.)
>
> Cheers,
> Hans-Martin
>

There are times where class variables can be useful outside the scope of the
class.  Not many mind you but some.  In those cases it's better to write an
accessor for the class variable.  If you really need access to #Descriptions
on TTFontDescription then, in my opinion, you should implement on the class
side the following

TTFontDescription class >> descriptions
        "return to the sender the content of the class variable
Descriptions"
        ^Descriptions

The major benefit of doing it this way is that you can then look for senders
of the accessor and find out where it is used (and then move the code where
it belongs on TTFontDescription)

Happy coding!

Ron Teitelbaum