Newsgroups: comp.lang.smalltalk
Path: cantaloupe.srv.cs.cmu.edu!rochester!udel!news.mathworks.com!newsfeed.internetmci.com!news.sprintlink.net!howland.reston.ans.net!ix.netcom.com!netcomsv!uu3news.netcom.com!netcomsv!uucp3.netcom.com!slcgate!servio!servio!aland
From: aland@servio.slc.com (Alan Darlington)
Subject: Re: Class Variables  -- Initialization?
Message-ID: <1995Jul19.212740.1709@slc.com>
Sender: news@slc.com (USENET News)
Nntp-Posting-Host: servio
Organization: GemStone Systems, Inc., Beaverton OR, USA
References: <3u6b05$3l9@charnel.ecst.CSUChico.EDU>
Date: Wed, 19 Jul 1995 21:27:40 GMT
Lines: 37

mcelroy@ecst.csuchico.edu (James Robert McElroy) writes:
> I have a question about class variables.  
> 
> I was looking in the Date class, and I see a couple of dictionaries
> that are class variables.  Now, for the life of me, I cannot figure
> out how these things were installed in the first place.  How do I
> hardwire some class variables if I want to?
> 
> Wait -- could you create a class method to initialize them, then 
> initialize them, then remove the class variable?  Hey, that might
> work!  If there is some other protocol or mechanism, please let 
> me know!
> -- 
> Jim McElroy
> Calif. State Univ., Chico
> mcelroy@ecst.csuchico.edu

If you just want to do a one-time initialization (I assume you meant
to remove the class method, not the class variable), then here is
a simple way.

Inspect the class (i.e. highlight the class name and "inspect it"
from your menu).  Inspect the classPool variable, which will give you
a dictionary inspector.  Select the variable you want to initialize.
Type a Smalltalk expression in the upper right pane (remove the
textual description there first).  Then use "save" from that pane's
menu.  The object resulting from the evaluation of the expression
will now be the new value of the class variable.

Details may vary, depending on your particular version of Smalltalk.

Hope this helps,
Alan

(standard disclaimer)


