Skip to Content.
Sympa Menu

sm-discuss - [SM-Discuss] Variable naming for sorcery variables (WAS: random y and n files?)

sm-discuss AT lists.ibiblio.org

Subject: Public SourceMage Discussion List

List archive

Chronological Thread  
  • From: evraire AT tuwg.com
  • To: sm-discuss AT lists.ibiblio.org
  • Subject: [SM-Discuss] Variable naming for sorcery variables (WAS: random y and n files?)
  • Date: 16 Sep 2004 19:23:49 -0000

Hello,

Quoting Andrew:
> 1) before using a variable (even one inside a for <!--filtered--> in *;
> loop), grep through sorcery for uses of that variable, if you find that
> variable in use ANYWHERE in sorcery please "just say no", use something
> more unique such as $SPELL_FOO rather than just FOO.

It seems to me it would be useful to have a reserved prefix for sorcery's
internal variable, such as "_SORCERY_". Using this example, the
sorcery-specific variable "DEBUG" would become "_SORCERY_DEBUG". Thus
spell-writers would know that their variable names are OK if they avoid using
the prefix. Otherwise spell writers need to grep the source code everytime
they write a spell, which makes spell writing more tedious than it need be.

Also, new variables added to sorcery could conflict with variables of the
same names in spells. In this case, the spell writer grepped sorcery to see
if a variable was in use and it wasn't, so they went ahead and used it in
their spell. A year later the same spell is used along with that variable
when a sorcery developer adds the same variable to sorcery. Unless the
developer casts that specific spell, the problem will likely go unnoticed
during their testing. When the problem finally does surface, it will
probably turn up as a bug against the spell. The maintainer of the spell
might very well be confused why this spell would suddenly break despite never
having been changed.

To me, this sounds like trouble waiting to happen. As sorcery becomes more
and more complex and more and more sorcery variables get defined, this
problem will only become worse. I realize changing all the internal sorcery
variables to a new nomenclature is a Big Deal(TM), but I think it's something
we should strive for in the long run. To begin with, a nomenclature for
internal sorcery variable names could be chosen and all new variables created
can follow this nomenclature. Then, over time, we can convert the remaining
variables to the new nomenclature.

What do you think?

Jonathan Evraire
evraire at tuwg.com


-------------------------------------------------------------
Message sent via http://toad-mail.net
Anti-spam notice, this message originated from IP Address: 199.212.215.11
-------------------------------------------------------------




Archive powered by MHonArc 2.6.24.

Top of Page