On May 2, 2009, at 10:16 AM, Massimo Manghi wrote:

On Fri, 1 May 2009 11:07:36 -0500, Karl Lehenbauer wrote
So you would prefer for it to work like an array?  Have an
"apache_table exists tableName key" and make "apache_table get
tableName key" force an error ?


in a word: yes.

How about if "get" still returns an empty string when the key doesn't exist but I implement "exists" for people who want to clearly distinguish between missing and empty?

I also considered adding an optional argument to "get" of a variable name to load with the value and having it return 1 or 0 on whether or not the key exists...

  if {[apache_table get notes key valueVar]} {
  }

...but it seems like overkill.

-karl

PS - As an aside, Tcl arrays should have a settable default, "array default arrayName 0" would be cool, although newer incr will instantiate a nonexistent variable at 0. Also there should be something like "array foreach arrayName var code".



---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscr...@tcl.apache.org
For additional commands, e-mail: rivet-dev-h...@tcl.apache.org

Reply via email to