Graham and everyone else who is interested or should be,
Since I started this thread with what I thought was a fairly naive
question with a pretty obvious conclusion, perhaps I should summarize
the input - if that is possible, what with some of the quite lengthy
monologues.
I believe that Richard and Jim have made the most poignant arguments
both for and against the use of globals; and I was leaning very
sharply in the CP direction until Graham made a very good point: CPs
do tend to involve writing a lot more code, and I have to learn
something that I've not used before; hence probably subject to some
errors in usage on my part - typos and otherwise.
So I intend to learn the CP approach down the road a bit, but
continue in the meanwhile with my use of Globals as I have in the
past. The code for CPs IS pretty "elaborate" and not totally
intuitive; at least to me. I can definitely see some advantages to
the CP approach, but maybe I'm too far gone to change at this point
in my life. Hey! I wouldn't even be using RR at all were it not for
Apple's failure to support HC on OSX. I used HC last night to make a
material list that I needed to parse and get to the manufacturer this
morning. It didn't need to be cross platform or even in color, so...
Of course I did it on my 9.2 Mac; something I'll probably keep around
for many years to come, though I'd love to get a new one on which I
can run 9.2. It was a great OS!
Thanks to everyone for their opinions and perspectives. I think we
all learned a lot.
Joe Wilkins
On Apr 2, 2007, at 2:53 PM, Graham Samuel wrote:
Forgive me if this conversation has ended, but my internet
connection has been in meltdown... just got back on line.
I most frequently use globals because there aren't global
constants. I use them very largely for strings containing stuff
like error messages or even very simple strings like "OK", so that
I can refer to these indirectly in scripts, thus allowing me to
switch (human) languages by redefining the globals in just one
script of the program. I guess I could have used custom property
sets with exactly the same effect, and with the advantage that I
wouldn't have to initialise them during the startup of my app, but
like many others I didn't understand these when I started, and I
tend to re-use stuff I wrote before. I guess there isn't much
difference between writing
answer gcOK -- 'gcOK' is a global with a string in it.
and
answer (the gcOK of stack "allTheConstantStrings") -- 'the gcOK'
is a property of some object.
but the second statement seems to have more characters in it, since
it involves referring to the object in which the property is
stored. If there are a lot of such references, my scripts are going
to get longer.
I also use globals when I have a quantity which needs to be used in
different scripts in different stacks, i.e globally: a very obvious
point, but I really don't see what is wrong with that. I do accept
that I have to be disciplined about changing their values. I do use
properties (I tend to use these for global status stuff like 'the
soundOn of this stack'), parameter-passing and message-passing
extensively, but to me globals feel right for quite a lot of things.
I shall now wait for someone to tell me why this is a really wrong-
headed approach. I'm always willing to learn - really.
Graham
----------------------------------------
Graham Samuel / The Living Fossil Co. / UK and France
_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your
subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution