Re: [tkined] Question about object-type DEFVAL

Juergen Schoenwaelder (schoenw@ibr.cs.tu-bs.de)
Thu, 18 Mar 1999 10:08:13 +0100

>>>>> Peder Chr Norgaard writes:

Peder> Considering Tcl's very limited type system, I suggest the most
Peder> elegant semantics would be the one used with Tcl's "regexp"
Peder> command: let the command deliver the "boolean" as the return
Peder> value, and give the "value" in a named upvar'd variable. If
Peder> you worry about backwards compatibility, you can use the
Peder> current (ambigious) interpretation if the caller does not
Peder> specify such a named variable.

Peder> Then I can say

Peder> if {[Tnm::mib defval <object> def]} {
Peder> process $def
Peder> }

Peder> which is exactly what I want.

I agree that throwing errors is not really a good idea. Another
solution would be the addition of another command option which checks
for the presence of a given construct, leading to code like:

if {[Tnm::mib check <object> defval]} {
process [Tnm::mib defval <object>]
}

The downside of this approach is that it requires to invoke two Tnm
commands where your approach only needs one. The advantage is that
there are no changes to existing Tnm::mib command options.

I actually think that your proposal is the better solution, but it
will take more time to implement, document and test your solution.

Juergen

-- 
Juergen Schoenwaelder  schoenw@ibr.cs.tu-bs.de http://www.cs.tu-bs.de/~schoenw
Technical University Braunschweig, Dept. Operating Systems & Computer Networks
Bueltenweg 74/75, 38106 Braunschweig, Germany.        (Tel. +49 531 / 391 3289)
--
!! This message is brought to you via the `tkined & scotty' mailing list.
!! Please do not reply to this message to unsubscribe. To subscribe or
!! unsubscribe, send a mail message to <tkined-request@ibr.cs.tu-bs.de>.
!! See http://wwwsnmp.cs.utwente.nl/~schoenw/scotty/ for more information.