Tcl_AllowExceptions(3)

πŸ“¦
version 9.0.3 Β· 2 versions
, in alpine 3.23, alpine 3.24, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable

πŸ’– 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_EvalObjEx
  • Tcl_EvalObjv
  • Tcl_Eval
  • Tcl_EvalEx
  • Tcl_GlobalEval
  • Tcl_GlobalEvalObj
  • Tcl_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