Wojciech Kocjan <[EMAIL PROTECTED]> writes:

> On 15 May 2001, David N. Welton wrote:

> > Well the problem is then with accessing specific variables, no?
> > You basically have to transform an array like this in something
> > useful.  I really want to try and arrive at a general solution
> > that presents the script writer with data that is already easy to
> > use.  They shouldn't have to do processing on it.

> Processing such stuff is 9 lines away:
> proc getarg {key lst} {
>     set rc [list]
>     foreach {n v} $lst {
>         if {$n==$key} {
>             lappend rc $v
>         }
>     }
>     return $rc
> }

Sure, but that's a pain.  PHP is successful because it is so immediate
and easy to use.

> > I'm not opposed to making this available, for those who want 'lower
> > level' access like this, though.

> Well, then do it ;-)

> > > This could be a good solution, too, if we don't care about
> > > replicating all variables in two places. (we must put values in VARS
> > > too, to keep compatibility with old scripts).

> > I am willing to break backwards compabitility if it is very
> > beneficial.  I would rather see things done right, while the user
> > base is still small.

> Yeah, that's what Tcl guys have been doing ;-) Just don't break any
> after 1.0 release... I don't want to see 10 dtcl packages in apt ;-)

IMO they haven't done enough.  This would all work if we had good
arrays of arrays, or real lists...

> > > Anyway the name-value list is a very comfortable solution. Since
> > > usually CGI variables are not so many, duplicating them shouldn't
> > > hurt too much.  Loking at the source code, I realize that the
> > > simpler thing to do would be simply adding a variable
> > > $::request::VARSL; thus the TCL code becomes

> > Ok, but you have to put that in an array to get a specific value
> > out that you know should be there.

> I prefer the above procedure. After putting it in GlobalInit, it's quite
> easy to use since I can do:
> foreach value [getarg checkbox $VARSL] {
>     hputs "You checked $value.<BR>"
> }

Talk about slow...

> > We could also create a command that does all the extra things we
> > want, precisely how we want.

> > set VARSL [vars list]
> > set foo [vars get foo]
> > set foo [vars get -array foo]

So what commands would people like to see for this?

vars get xyz
vars list
var arraylist xyz # returns a list suitable for use in an array.

-- 
David N. Welton
Free Software: http://people.debian.org/~davidw/
   Apache Tcl: http://tcl.apache.org/
     Personal: http://www.efn.org/~davidw/
         Work: http://www.innominate.com/

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

Reply via email to