interp(3tcl)

πŸ“¦
version 2.0 Β· 2 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– interp(3tcl) β€” Interpreter utilities πŸ’–

okay bestie, gather round, because this is the interp page from Tcllib's manual and it is lowkey iconic. it's all about making Tcl interpreters that are extremely locked down, plus the aliasing magic that makes them actually useful. let's get into it ✨


🌸 NAME 🌸

interp β€” Interp creation and aliasing. that's the whole vibe. we make 'em, we alias 'em, we go home. πŸ’…


✨ 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 whose entire personality is convenient creation of Tcl interpreters for highly restricted execution. like, sandbox-coded. very demure, very mindful, very no-you-may-not-run-that. πŸŽ€


πŸ‘‘ API πŸ‘‘

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

this one builds you an empty Tcl interpreter and hands you back its name. and when we say empty we mean empty: the new interpreter has neither namespaces, nor any commands. it is useful only for the creation of aliases. that's it. that's its whole job. it's giving blank canvas, main character energy, no thoughts head empty (on purpose). πŸ™ˆ

if a path is specified then it is taken as the name of the new interpreter. so you get to name your baby. 🍼

this command assumes that it was called from within a method of a snit object, and that the command mymethod is available. yes, that's the assumption, it just trusts you, bestie. 🫢

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. 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. so heads up, first word = the method name. iykyk. ⭐

the result of the command is the empty string. no confetti, no nothing. it just works and says nothing. very mysterious. πŸ’€

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. so when the one-to-one thing isn't enough, you upgrade. glow up fr fr. 🌈

the result of the command is the empty string. again. silent queen. πŸ‘‘


😭 BUGS, IDEAS, FEEDBACK 😭

ngl this document, and the package it describes, will undoubtedly contain bugs and other problems. it's giving humble but also accurate. please report such in the category interp of the Tcllib Trackers at [http://core.tcl.tk/tcllib/reportlist]. please also report any ideas for enhancements you may have for either package and/or documentation. we want them, genuinely. πŸ₯Ί

when proposing code changes, please provide unified diffs, i.e the output of diff -u. no vague vibes-only patches, we need the actual diff. periodt. πŸ’…

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. yes that exact button. the left-most one. go get it. πŸŽ€


πŸ”₯ 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, you ate it πŸ“πŸ’…

and for the cute sign-off: this lil masterpiece is from tcllib, version 0.1.3 β€” that's what the footer's been whispering this whole time. go forth and sandbox responsibly βœ¨πŸ¦‹πŸŽ€

πŸ“¦ where this page comes from