[Xotcl] Asserts off/on
Uwe Zdun
zdun at infosys.tuwien.ac.at
Tue Jul 11 18:24:29 CEST 2006
The method "check" can be used to turn off assertions. The example from
the tutorial:
$fb check all
if {[catch {$fb set playerRole SINGER} errMsg]} {
puts "CATCHED EXCEPTION: playerRole has either to be NONE, PLAYER, or TRAINER"
# turn assertion checking off again and reset to PLAYER
$fb check {}
$fb set playerRole PLAYER
}
The idea is per default all checks are off. Then you turn them on for the objects, you want to be checked in a development environment,
and simply remove the "turn-on code" for the production environment (or redefine the method check, if you want to do it for all methods
at once).
--uwe
Kristoffer Lawson wrote:
> Have I missed something, or is there no easy way of turning asserts
> off or on for all objects? It's common that during the development
> phase you want all the asserts turned on and, perhaps for performance
> reasons, turn them off when finished. I know it could be possible by
> overwriting the create method, or whatever, but I was looking for
> something... well ... less hacky.
>
> / http://www.fishpool.com/~setok/
>
> _______________________________________________
> Xotcl mailing list
> Xotcl at alice.wu-wien.ac.at
> http://alice.wu-wien.ac.at/mailman/listinfo/xotcl
More information about the Xotcl
mailing list