sm-discuss AT lists.ibiblio.org
Subject: Public SourceMage Discussion List
List archive
- From: Andrew <afrayedknot AT thefrayedknot.armory.com>
- To: sm-discuss AT lists.ibiblio.org
- Subject: Re: [SM-Discuss] random y and n files?
- Date: Wed, 15 Sep 2004 21:26:09 -0700
On Wed, Sep 15, 2004 at 09:23:02PM -0700, Eric Sandall wrote:
> Quoting Andrew <afrayedknot AT thefrayedknot.armory.com>:
> <snip>
> > 3) declare variables "local" before using them (unless config_query
> > defines it, in which case it takes care of that). Variables not defined
> > "local" are defined in the global context and can really mess things up
> > (like DEBUG).
>
> Does the "local" requirement include persistent_add variables (I don't
> think so,
> since it's part of the config_query system, but just being pedantic ;))?
>
config_query calls persistent_add. It is not wrong to declare a variable
local and persistent simultaneously.
You have two situations
local foo
config_query foo "..." n
and
config_query foo "..." n
local foo
In the first example the local is basically useless other than the
variable is shielded from the global context. In the second you unset
the value that config_query set which is generally not what you wanted.
In both cases once the spell file ends persistency destroys the variable
which is generally a bad thing if its a sorcery variable.
One other tip i neglected to point out. If you really need to set
some generic variable like DEBUG (like say in BUILD) you can do it
inside ( ) to shield sorcery functions like prepare_install from
getting confused and leaving random files everywhere (although they'll
mostly just be in the build directory and go away it makes sorcery
debugging annoying for those spells).
-Andrew
--
__________________________________________________________________________
|Andrew D. Stitt | astitt at sourcemage.org |
|irc: afrayedknot | afrayedknot at t.armory.com |
|aim: thefrayedknot or iteratorplusplus | |
|Sorcery Team Lead, Porting Team Lead | |
|Grimoire Guru ham/smgl | ftp://t.armory.com |
|Author and Maintainer of Prometheus | |
--------------------------------------------------------------------------
Attachment:
pgpdazshl0ZBS.pgp
Description: PGP signature
-
[SM-Discuss] random y and n files?,
Jeremy A. Kolb, 09/15/2004
-
Re: [SM-Discuss] random y and n files?,
Eric Sandall, 09/15/2004
- Re: [SM-Discuss] random y and n files?, Jason Flatt, 09/15/2004
-
Re: [SM-Discuss] random y and n files?,
Andrew, 09/16/2004
-
Re: [SM-Discuss] random y and n files?,
Eric Sandall, 09/16/2004
- Re: [SM-Discuss] random y and n files?, Andrew, 09/16/2004
-
Re: [SM-Discuss] random y and n files?,
Eric Sandall, 09/16/2004
-
Re: [SM-Discuss] random y and n files?,
Eric Sandall, 09/15/2004
Archive powered by MHonArc 2.6.24.