[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Is "static" meaningful in Objective-C methods?
From: |
Russell Standish |
Subject: |
Re: Is "static" meaningful in Objective-C methods? |
Date: |
Thu, 2 Nov 2000 12:46:40 +1100 (EST) |
Let me butt in: It seems that the solution to Paul's problem to define
a sim. anneal class, and to store the relevant instance variables
there. Then messages pass to the enclosing class can be forwarded onto
the sim. anneal class.
Paul E Johnson wrote:
>
> "Marcus G. Daniels" wrote:
> >
> > >>>>> "PJ" == Paul E Johnson <address@hidden> writes:
> > PJ> Using this in Swarm would let me get rid of a bunch of IVARS that hold
> > PJ> values of seldom-used methods, so I could clean up some code.
> >
> > It seems fishy that an instance variable would ever be changed to static
> > state, since one is local to an object and the other modifies the
> > behavior of any object that calls the method.
>
> OK, I don't want instances to share the static variable, so I won't do
> it.
>
> So you don't think I'm totally insane, here is why I wanted do do this.
> I was looking at using simulated annealing to optimize something (the
> Gnu Scientific Library code makes it quite clear how this can be done,
> incidentally). In the method to do the simulated annealing, it uses
> some variables that are adjusted each time the method is called. For
> example, the T variable ("Temperature") shrinks T just a bit, say
> T=T/1.1. T is used in no other methods, so it is not needed as an IVAR,
> except that each time the method is called, of course, it has to know
> its previous value.
>
> I'm reading a C book that recommends using static locals in place of
> global variables where possible. Too bad Obj-C methods don't allow it.
>
> --
> Paul E. Johnson email: address@hidden
> Dept. of Political Science http://lark.cc.ukans.edu/~pauljohn
> University of Kansas Office: (785) 864-9086
> Lawrence, Kansas 66045 FAX: (785) 864-5700
>
> ==================================
> Swarm-Support is for discussion of the technical details of the day
> to day usage of Swarm. For list administration needs (esp.
> [un]subscribing), please send a message to <address@hidden>
> with "help" in the body of the message.
>
----------------------------------------------------------------------------
Dr. Russell Standish Director
High Performance Computing Support Unit, Phone 9385 6967
UNSW SYDNEY 2052 Fax 9385 6965
Australia address@hidden
Room 2075, Red Centre http://parallel.hpc.unsw.edu.au/rks
----------------------------------------------------------------------------
==================================
Swarm-Support is for discussion of the technical details of the day
to day usage of Swarm. For list administration needs (esp.
[un]subscribing), please send a message to <address@hidden>
with "help" in the body of the message.