HP3000-L Archives

November 1996, Week 1

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Greg Chaplin <[log in to unmask]>
Reply To:
Greg Chaplin <[log in to unmask]>
Date:
Wed, 6 Nov 1996 13:13:01 +1000
Content-Type:
text/plain
Parts/Attachments:
text/plain (37 lines)
On Nov 5, in response to my response about this, Jeff Vance asked a couple of
questions:

---------------------------------------------------------------------
1. QUESTION: Are there any examples where you need to distinguish between
who can create vs. write vs. delete a global var?

In my current environment, I can't think of any.  Anyone else have
any examples?

---------------------------------------------------------------------
2. Greg, do you see value in "script-local' vars, meaning they are local
to a script and are automatically deleted when the script exits?
They could be inherited by scripts called by the creating script.

If "local variables" include "script-local" vars, then yes
(enthusiastically) I would definitely use them - ensuring that all
the script-local vars are cleaned up on exiting the script is a pain
when there is more than 1 exit point (using "return" and "escape").

I use a naming convention where the variables are prefixed with the
script's name - eg. the MENUXFER script's variables are named
menuxfer_....  At each exit point, I execute another script called
DELVAR which deletes all variables with that script's prefix.  Note
that if you just did DELETEVAR MENUXFER_@ and there were no variables
found, it would produce a warning and overwrite the value of CIERROR,
etc, which I often check in calling scripts.

Anyway (getting back to the point), it would be great if I didn't have to worry about
cleaning up these script-local vars.

Greg Chaplin
UniSuper
Level 28, 367 Collins St,      Email: [log in to unmask]
Melbourne 3000,                 Phone: +61 3 9648 4145
Australia.                             Fax: +61 3 9648 4141

ATOM RSS1 RSS2