interp(n)

πŸ“¦
version 2.0 Β· 2 versions
, in fedora 43, fedora 44, nixos 26.05, nixpkgs unstable

✨ interp(n) β€” Interpreter utilities ✨

okay bestie, so this is the interp manual page from Tcllib, and it's literally the page about making baby Tcl interpreters for when you want something to run in a highly restricted little sandbox πŸŽ€. No cap, it's niche but it slays.


🌸 SYNOPSIS 🌸

package require Tcl 8.5 9

package require interp ?0.1.3?

::interp::createEmpty ?path?

::interp::snitLink path methodlist

::interp::snitDictLink path methoddict

πŸ’– DESCRIPTION πŸ’–

So this package hands you a handful of commands for conveniently creating Tcl interpreters for highly restricted execution. Like, locked-down baby interpreters that only get to do exactly what you say. It's giving ✨controlled environment✨, it's giving main character energy for sandboxing, and honestly? obsessed. 🫢


πŸ‘‘ API πŸ‘‘

πŸ’… ::interp::createEmpty ?path?

This command creates an empty Tcl interpreter and returns its name. And bestie, "empty" here is not a vibe, it's a fact: the new interpreter has neither namespaces, nor any commands. Like, nothing. Zero. It is useful only for the creation of aliases.

If a path is specified, then it is taken as the name of the new interpreter.

This command assumes that it was called from within a method of a snit object, and that the command mymethod is available.

It extends the interpreter specified by path with aliases for all methods found in the methodlist, with the alias directing execution to the same-named method of the snit object invoking this command. And here's the plot twist 🫒 β€” each element of methodlist is actually interpreted as a command prefix, with the first word of each prefix the name of the method to link to.

The result of the command is the empty string.

This command behaves like ::interp::snitLink, except that it takes a dictionary mapping from commands to methods as its input, and not a list of methods. Like for ::interp::snitLink, the method references are actually command prefixes. This command allows the creation of more complex command-method mappings than ::interp::snitLink does. So if you need the deluxe version of the mapping, this is her. πŸ’…

The result of the command is the empty string.


πŸ¦‹ BUGS, IDEAS, FEEDBACK πŸ¦‹

This document, and the package it describes, will undoubtedly contain bugs and other problems. 😭

Please report such in the category interp of the Tcllib Trackers [http://core.tcl.tk/tcllib/reportlist]. Please also report any ideas for enhancements you may have for either package and/or documentation. We love ideas fr fr. 🌈

When proposing code changes, please provide unified diffs, i.e the output of diff -u.

Note further that attachments are strongly preferred over inlined patches. Attachments can be made by going to the Edit form of the ticket immediately after its creation, and then using the left-most button in the secondary navigation bar. iykyk ✨


πŸ”₯ KEYWORDS πŸ”₯

alias, empty interpreter, interpreter, method, snit


πŸŽ€ CATEGORY πŸŽ€

Programming tools


Copyright (c) 2006 Andreas Kupries <andreas_kupries@users.sourceforge.net>


okay that's the whole page bestie, no notes πŸ’– this was tcllib version 0.1.3 of the interp(n) page β€” mwah, go build something restricted and iconic πŸ‘‘βœ¨

πŸ“¦ where this page comes from