Cristian wrote:
Hi massimo,
I finaly found the archives by googling for rivet-dev and archive. It
is even searchable! Will check there in the future before posting...
So if I understand it correctly, wouldn't the following solve the problem?
i suspect the answer depends on what you expect from load_response.
I can understand from the archive is that the debate was not only about
load_response "per se", but how everyone expected to use it to suit their
approach to the problem.
A strong point was that load_response is taken from NeoWebScript,
a Tcl based web development tool which could be already familiar to
the a new Rivet user and it wouldn't make sense to confuse him/her.
Having many procs that make the same job in a different way would
be a possible solution (indroducing switches like "-opt1 -opt2" received
little appreciation)
proc load_response {{arrayName response}} {
upvar 1 $arrayName response
array set response {}
foreach {var elem} [var all] {
if {[info exists response($var)]} {
set response($var) [lappend response($var) [list $elem]]
} else {
set response($var) [list $elem]
}
}
}
In my personal case your code would work, but as I said, this is
only the way in which I used load_response.
I made a test feeding your code and the code in Rivet with a series
of list valued elements and the output is radically different.
Cristian's:
for {set i 0} {$i<10} {incr i} { if {[info exists lista]} { set lista
[lappend lista [list elemento $i]] } else { set lista [list elemento $i] }}
the first element is treated as a 2 elements list whereas the others are
nested lists appended as sibling elements
Rivet's:
for {set i 0} {$i<10} {incr i} { if {[info exists lista]} { set lista
[list $lista [list elemento $i]] } else { set lista [list elemento $i] }}
the output in 'lista' is a series of deeply nested elements...
file load_response_test.rvt:
---
load_response
if { [ array exists response ] } {
foreach { ck } [ array names response ] {
puts "response($ck) = $response($ck)\n"
}
}
---
which for a
http://localhost:8081/load_response_test.rvt?foo=bar+baz&fee=bat&foo=bak
<http://localhost:8081/load_response_test.rvt?foo=bar+baz&fee=bat&foo=bak>
produces:
response(fee) = bat
response(foo) = {bar baz} bak
Or will the load_response proc be deleted from the sources?
Cristian
I think the answer to the last question is negative, this would break
the code and
it wouldn't be a sensible approach to the problem.
-- Massimo
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]