Tcl_AllowExceptions(3)
π Tcl_AllowExceptions β the manual page, but make it make sense π
okay bestie, welcome to the Tcl Library Procedures section, this one's literally called Tcl_AllowExceptions(3) and it's lowkey a tiny function with main character energy β¨
πΈ NAME πΈ
Tcl_AllowExceptions β allow all exceptions in the next script evaluation π«Ά
π SYNOPSIS π
#include <tcl.h>
Tcl_AllowExceptions(interp)
β¨ ARGUMENTS β¨
Tcl_Interp *interp(in) β the interpreter where the script is gonna get evaluated π that's it, that's the whole argument list, we love a minimal queen.
π DESCRIPTION π
okay so here's the tea π
If a script gets evaluated at top-level β meaning like, no other scripts are pending evaluation when you invoke it, she's the only one on stage β and if that script finishes up with a completion code that is not TCL_OK, not TCL_ERROR, and not TCL_RETURN, then Tcl normally does its little glow-up thing and converts that into a TCL_ERROR return with an appropriate message. π
The specific Tcl script-evaluation procedures that act this way (iykyk, these are the girlies doing the converting) are:
Tcl_EvalObjExTcl_EvalObjvTcl_EvalTcl_EvalExTcl_GlobalEvalTcl_GlobalEvalObjTcl_VarEval
BUT. π And this is the plot twist. If you invoke Tcl_AllowExceptions immediately before calling one of those procedures up there, then arbitrary completion codes are permitted to come out of the script, and they get returned without modification. No glow-up, no conversion, she comes out exactly how she went in. periodt. π
This is highkey useful in cases where the caller can actually deal with exceptions like TCL_BREAK or TCL_CONTINUE in a meaningful way. Like, if you know what you're doing with those codes, this is your moment. slay π
ngl the "immediately before" part is doing a lot of work in that sentence β it's the whole vibe check of this function. don't skip it bestie π
π¦ KEYWORDS π¦
continue, break, exception, interpreter β
okay that's the whole page!! thanks for coming to my TED talk π this was the Tcl manual, version 7.4, and the page was Tcl_AllowExceptions(3) β catch you in the next one, mwah πβ¨π«Ά
π¦ where this page comes from
- alpine 3.23: tcl9-doc 9.0.3-r0 Β· TCL
- alpine 3.24: tcl9-doc 9.0.3-r2 Β· TCL
- fedora 43: tcl-doc 1:9.0.2-1.fc43 Β· TCL AND GPL-3.0-or-later WITH Bison-exception-2.2 AND BSD-3-Clause
- fedora 44: tcl-doc 1:9.0.2-1.fc44 Β· TCL AND GPL-3.0-or-later WITH Bison-exception-2.2 AND BSD-3-Clause
- nixos 26.05: tcl 9.0.3
- nixpkgs unstable: tcl 9.1.0
- Copyright (c) 1989-1993 The Regents of the University of California
- Copyright (c) 1994-1996 Sun Microsystems, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms