Am 30.05.2005 um 19:21 schrieb [EMAIL PROTECTED]:
The question is what ns_proc will do if i give wrong type?
Throw error.
Catching all ns_proc calls for exceptions will make code not very
clear?
How typechecks will be enforced?
That is the *exact* reason why you need checks: to throw error!
If you need no checks then "none" or "string" should be given
in which case no checking will be performed. But if you *need*
checks than Tcl offers nothing that will assist you.
Just to be clear: what I mean is *not* replace the "proc" call
with ns_proc. I think about augmeting the "proc" with ns_proc
so both could be used. So, only for new code this will make sense.
I *very* frequently run into the checking all arguments
using [string is...] type of checks and if one check fails
I generate error. It is so often repeated that I find it
very annoying to write all those over and over.
That is the reason why I like what Stephen made and am
not giving up :-)
One of the major TCL strengts *and* weaknesses is: lack of type
checking.
Now, to assert this on the variable level is impossible and I doubt that
this will ever happen. But enforcing it on the procedure level is very
simple and handy (for exmaple like this effort we're discussing now)
and we should eventually agree on some of the ways. Thanks to Stephens
work, we already have this on C-level. It would be great if we can
extend it to Tcl level as well in some meaningful way.
Zoran