Re: Namespaces

new topic     » goto parent     » topic index » view thread      » older message » newer message

On 24 Oct 2000, at 19:34, Fam. Nieuwenhuijsen wrote:

> > If you add the declare, you can't do the dynamic name generation, cause
> the
> > programmer would haveto know all the names of all the vars as she is
> writing the code.
>
>
> You will need to know all the names of all the vars anyway, otherwise you
> can't look them up. And if you to look them up dynamically as well, then
> there is already the a-list.

<chatty.mode=on>

I missed the definition of "alist" somehow. But i do a lot of this dynamic name
generation, and call them again dynamically. It beats a loop to search a
database,
especially when you want to delete vars based on a wildcard match. For example:

if ( %traceroute.done. [ $+ [ $gettok(%traceroutekick. [ $+ [
 %traceroute.kickindex ] ]
,2,32) ] $+ . $+ [ $gettok(%sockname,2-,$asc(.)) ] ] == $null ) {
.dde TiggrBot1 command  ""  /ddekickban $gettok(%traceroutekick. [
            $+ [
%traceroute.kickindex ] ] ,2,32) $gettok(%sockname,2-,$asc(.))
$gettok(%traceroutekick. [ $+ [ %traceroute.kickindex ] ] ,3-,32)
            set -u10 %traceroute.done. [ $+ [ $gettok(%traceroutekick. [ $+ [
%traceroute.kickindex ] ] ,2,32) ] $+ . $+ [ $gettok(%sockname,2-,$asc(.)) ] ]
did
          }

That generates and uses vars by names i cannot possibly foresee, and seems to do
it
without any loss of speed (other than the calls to $gettok()) over using plain
generic
variable nomenclature such as "x".

When starting up, i can simply do this:

unset %traceroute.done.*

and "forget" all the %traceroute.dones before from memory, no need to go find
all of
them by hand (altho in the above code, if the program is not interrupted, the
vars auto-
clear in 10 seconds anyhow). But %traceroute.available* isn't lost, nor is
%traceroute.ok, nor etc. While in memory, i can find them by many various
wildmatches, or by exact match, or a timewasting brute force SaveVarsToFile -
SearchTheFile loop. The program can know what it knows, and know what it doesn't
know quite easily.

And yeas,, that code executes hundreds of times a day, without errors. smile

Kat

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu