I am doing an eval in the contents of the file. The file is made of tags that I parse. Each line has a label, and for each label there is a proc , so eval succeeds. However, sometimes users add new tags, and then the eval command fails due to an unknown command.
Is there a way to prevent Tcl from crashing when trying an eval an unknown command?
Ideally, this should allow me to substitute my own specific behavior - for example, bring an error and continue with eval .
EDIT :
Unfortunately, I can only use Tcl 8.4.
I tried to do the following, as suggested here :
proc handle_unknown_label {cmd args} { ... }
and then:
rename unknown _old_system_unknown rename handle_unknown_label unknown catch {set ret [eval $x]} err rename unknown handle_unknown_label rename _old_system_unknown unknown
but I still get the same behavior for eval and it prints the following errors:
unknown procedure - a protected procedure and will not be renamed to an unknown procedure is a protected procedure and will not be overcome unknown procedure is a protected procedure and will not be renamed
an unknown procedure is a protected procedure and will not exceed
source share