On Wed, 16 May 2001, Valerio Gionco wrote:
> What I like best is:
> 
>      set xxx [vars arraylist];         #to get a list of key-value pairs in
> $xxx
> 
> To improve speed, in some cases:
>      set xxx [vars get xyz];           #to get the value of xyz in $xxx
> could go, but one MUST first check for the existence of xyz... what if xyz
> is undefined? We should have something like 'vars exists xyz':

vars get -default "novalue" xyz

> if {[vars exists xyz]} {
>       set xyz [vars get xyz];
>       puts "The value of xyz is $xyz"
>    }
> ...I'm afraid this would be even slower, on most cases. In 99% of
> applications the script uses all the parameters.

That's why the user should choose whether to use vars or $VARS...

$VARS should be used where you access many variables - hashing should be
faster than browsing apreq... While if you only access 5 out of 20
variables (and access the rest only in 1/50 cases :-), vars should be
faster...

I also came up with another solution - if QUERY_STRING is 'x=a&x=b&x=c'
then $VARS(x) would be either one of them, but ONLY when >1 value exists,
then VARSL (or LVARS - sounds better :-) is set. This way you avoid
duplicate values.

But I'm not sure if it's so easy to check if an entry in apreq is the only
entry with such name...

--
Wojtek Kocjan
[EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to