To be honest, I rarely ever use the -array option. I use the -list and
-llist options almost exclusively. Especially for Tcl 8.4, lists have
even become more attractive. I added the -array option, just for
versitility (more ways to do things).

On Tue, 2002-12-24 at 12:30, Tom Jackson wrote:
> Brett,
>
> I think you would have to factor in the problem of parsing the attribute
> name out of the array element name, plus you can't easily search for an
> element by name either.

# This is essentially the same as ns_set find
foreach {K V} [array get myarr *,some_attr] {
    puts "This is an element for 'some_atttr' with key $K: $V"
}

OR

foreach K [array names myarr *,some_attr] {
    puts "This is an element for 'some_atttr' with key $K: $myarr($K)"
}

Is this what you mean?

> Ns_set supports mulitple attributes with the same name, as well as
> attribute order. Arrays mess up the order, that is why they are faster,
> for one.
>

Yes, an array element would get clobbered if there were 2 attributes of
the same name. However, I have always found it good practise to rename
attributes that have the same name as another attribute, using the SQL
'AS' keyword. But, I know that not everyone does this. Again, the -array
option is not a useful option in all cases.

Bottom line is that I wasn't looking to *replace* ns_set, just to add an
alternative; ns_set has alot of good features to it. In some cases,
ns_set might be the right choice; in other cases, it may not be the
right choice. I plan on adding more features to the module as well,
since this was just a first time pass at it...

Thanks for the feedback,

    --brett

--
Brett Schwarz
brett_schwarz AT yahoo.com

Reply via email to