We modified ad_proc to understand preconditions to method execution through a
@pre
comment (ala icontract - http://www.reliable-systems.com/tools/iContract/iContract.htm)
This lets us test assertions on entry into a given tcl procedure on our development servers while completely avoiding the assertion in production.
Example:
ad_proc foobar { zip radius } {
@pre [empty_string_p [vs_validate_zip $zip]]
@pre $radius >= 0
} {
}
On our development servers, we parse out the preconditions from the documentation for the procedure and add assertions to the body of the tcl proc itself.