Tcl commands in TypeScript

TypeScript implementations of 16 Tcl standard library functions across 1 module. Each function is individually importable and tree-shakeable.

string

We have 16 Tcl functions so far - help us add more

Got a rainy Sunday afternoon and a taste for a porting puzzle?

  • Get inspiration from the Tcl command reference.
  • Click "New file" in the appropriate folder on GitHub. This will fork the project to your account, directly add the file to it, and send a Pull Request to us.

We will then review it. If it's useful to the project and in line with our contributing guidelines your work will become part of Locutus and you'll be automatically credited in the authors section accordingly.

Upstream Surface Inventory 15/277 shipped · 68 next 5%

Locutus tracks 13 upstream namespaces for Tcl and sorts them into what is already shipped, what we still want, what we intentionally keep, and what still needs a decision.

This inventory now tracks Tcl's broader core command surface and standard ensembles first, excluding only host-specific extension ecosystems beyond core Tcl.

5% catalog shipped
Shipped Next Explicit non-goals
string 65% core 0% dict 0% file 0% clock 0% array 0% encoding 0% binary 0% info 0% namespace 0% package 0% chan 0% zlib 0%
Tracked namespaces 13
Shipped 15/277
Next to port 68
Explicit non-goals 194
Intentional extras 1

In progress

string ensemble

Tcl 8.6 · Catalog source: live runtime snapshot python:3.12

71% shipped
15/21 shipped 6 next 2 explicit non-goals 1 intentional extras
Shipped (16)

Next

Tcl string subcommands map naturally onto JS string and array values.

  • cat
  • index
  • replace
  • totitle
  • wordend
  • wordstart

Intentional extras

Explicit non-goals (2)
  • bytelength Skip Byte-length helpers add little value in a UTF-16 JS runtime.
  • is Skip Tcl classifier subcommands are too broad and type-system-specific for one clean port.

standalone core commands

Tcl 8.6 · Catalog source: live runtime snapshot python:3.12

0% shipped
0/19 shipped 19 next 70 explicit non-goals

Next

List/string concatenation has a clean plain-value contract.

  • concat

Scalar expression helpers are useful portability targets.

  • expr

Formatting helpers are strong plain-value portability targets.

  • format

Joining helpers have a clean plain-value contract.

  • join

List destructuring helpers can be represented as plain arrays.

  • lassign

Indexed access has a clean plain-value contract.

  • lindex

Pure list insertion has a clean plain-value contract.

  • linsert

List construction has a clean plain-value contract.

  • list

Size helpers have a clean plain-value contract.

  • llength

List slicing has a clean plain-value contract.

  • lrange

Repetition helpers have a clean plain-value contract.

  • lrepeat

Pure list replacement has a clean plain-value contract.

  • lreplace

Reversal helpers have a clean plain-value contract.

  • lreverse

Search helpers have a clean plain-value contract.

  • lsearch

Sorting helpers have a clean plain-value contract.

  • lsort

Regex matching is a strong plain-value portability target.

  • regexp

Regex replacement is a strong plain-value portability target.

  • regsub

Parsing helpers have a clean plain-value contract.

  • scan

String splitting is a strong plain-value portability target.

  • split
Explicit non-goals (70)
  • after Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • append Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • apply Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • auto_execok Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • auto_import Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • auto_load Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • auto_load_index Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • auto_qualify Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • break Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • case Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • catch Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • cd Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • close Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • continue Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • coroutine Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • eof Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • error Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • eval Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • exec Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • exit Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • fblocked Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • fconfigure Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • fcopy Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • fileevent Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • flush Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • for Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • foreach Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • gets Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • glob Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • global Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • history Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • if Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • incr Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • interp Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • lappend Skip Variable-backed list mutation is outside Locutus' value-only model.
  • lmap Skip Callback-driven mapping does not fit one stable Locutus contract yet.
  • load Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • lset Skip Variable-backed list mutation is outside Locutus' value-only model.
  • open Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • pid Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • proc Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • puts Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • pwd Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • read Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • rename Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • return Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • seek Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • set Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • socket Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • source Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • subst Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • switch Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • tailcall Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • tclLog Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • tell Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • throw Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • time Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • trace Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • try Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • unknown Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • unload Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • unset Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • update Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • uplevel Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • upvar Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • variable Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • vwait Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • while Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • yield Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.
  • yieldto Skip Tcl core commands mix control flow, procedures, namespace mutation, and environment access too broadly for one direct Locutus wishlist.

dict ensemble

Tcl 8.6 · Catalog source: live runtime snapshot python:3.12

0% shipped
0/11 shipped 11 next 9 explicit non-goals

Next

Tcl dictionary transforms map naturally onto JS plain objects and arrays.

  • create
  • exists
  • filter
  • get
  • keys
  • map
  • merge
  • remove
  • replace
  • size
  • values
Explicit non-goals (9)
  • append Skip Variable-backed dictionary mutation is outside Locutus' value-only model.
  • for Skip Callback-style iteration is not a good Locutus portability target.
  • incr Skip Variable-backed numeric mutation is outside Locutus' value-only model.
  • info Skip Internal representation details are not a stable plain-value target.
  • lappend Skip Variable-backed dictionary mutation is outside Locutus' value-only model.
  • set Skip Variable-backed dictionary mutation is outside Locutus' value-only model.
  • unset Skip Variable-backed dictionary mutation is outside Locutus' value-only model.
  • update Skip Variable-backed dictionary mutation is outside Locutus' value-only model.
  • with Skip Scoped variable mutation is outside Locutus' value-only model.

file ensemble

Tcl 8.6 · Catalog source: live runtime snapshot python:3.12

0% shipped
0/10 shipped 10 next 24 explicit non-goals

Next

Path decomposition helpers are strong plain-string portability targets.

  • dirname
  • extension
  • rootname
  • tail

Path joining has a clean plain-string contract.

  • join

Path normalization helpers have a useful plain-string contract.

  • nativename
  • normalize

Path classification has a clean plain-string contract.

  • pathtype

Path metadata helpers have a clean plain-string contract.

  • separator

Path splitting has a clean plain-value contract.

  • split
Explicit non-goals (24)
  • atime Skip Most filesystem helpers depend on host state or mutate the filesystem.
  • attributes Skip Most filesystem helpers depend on host state or mutate the filesystem.
  • channels Skip Most filesystem helpers depend on host state or mutate the filesystem.
  • copy Skip Most filesystem helpers depend on host state or mutate the filesystem.
  • delete Skip Most filesystem helpers depend on host state or mutate the filesystem.
  • executable Skip Most filesystem helpers depend on host state or mutate the filesystem.
  • exists Skip Most filesystem helpers depend on host state or mutate the filesystem.
  • isdirectory Skip Most filesystem helpers depend on host state or mutate the filesystem.
  • isfile Skip Most filesystem helpers depend on host state or mutate the filesystem.
  • link Skip Most filesystem helpers depend on host state or mutate the filesystem.
  • lstat Skip Most filesystem helpers depend on host state or mutate the filesystem.
  • mkdir Skip Most filesystem helpers depend on host state or mutate the filesystem.
  • mtime Skip Most filesystem helpers depend on host state or mutate the filesystem.
  • owned Skip Most filesystem helpers depend on host state or mutate the filesystem.
  • readable Skip Most filesystem helpers depend on host state or mutate the filesystem.
  • readlink Skip Most filesystem helpers depend on host state or mutate the filesystem.
  • rename Skip Most filesystem helpers depend on host state or mutate the filesystem.
  • size Skip Most filesystem helpers depend on host state or mutate the filesystem.
  • stat Skip Most filesystem helpers depend on host state or mutate the filesystem.
  • system Skip Most filesystem helpers depend on host state or mutate the filesystem.
  • tempfile Skip Most filesystem helpers depend on host state or mutate the filesystem.
  • type Skip Most filesystem helpers depend on host state or mutate the filesystem.
  • volumes Skip Most filesystem helpers depend on host state or mutate the filesystem.
  • writable Skip Most filesystem helpers depend on host state or mutate the filesystem.

clock ensemble

Tcl 8.6 · Catalog source: live runtime snapshot python:3.12

0% shipped
0/7 shipped 7 next

Next

Clock formatting and conversion helpers still have a useful plain-value contract.

  • add
  • clicks
  • format
  • microseconds
  • milliseconds
  • scan
  • seconds

array ensemble

Tcl 8.6 · Catalog source: live runtime snapshot python:3.12

0% shipped
0/4 shipped 4 next 7 explicit non-goals

Next

Presence predicates have a clean plain-value contract.

  • exists

Whole-array extraction can be represented as plain objects or entry arrays.

  • get

Key enumeration has a clean plain-value contract.

  • names

Size helpers have a clean plain-value contract.

  • size
Explicit non-goals (7)
  • anymore Skip Tcl arrays are variable-backed dictionaries rather than direct plain values.
  • donesearch Skip Tcl arrays are variable-backed dictionaries rather than direct plain values.
  • nextelement Skip Tcl arrays are variable-backed dictionaries rather than direct plain values.
  • set Skip Tcl arrays are variable-backed dictionaries rather than direct plain values.
  • startsearch Skip Tcl arrays are variable-backed dictionaries rather than direct plain values.
  • statistics Skip Tcl arrays are variable-backed dictionaries rather than direct plain values.
  • unset Skip Tcl arrays are variable-backed dictionaries rather than direct plain values.

encoding ensemble

Tcl 8.6 · Catalog source: live runtime snapshot python:3.12

0% shipped
0/3 shipped 3 next 2 explicit non-goals

Next

Encoding conversion helpers are useful portability targets when kept in string space.

  • convertfrom
  • convertto
  • names
Explicit non-goals (2)
  • dirs Skip Encoding search-path configuration depends on host runtime setup.
  • system Skip Changing system encoding mutates ambient runtime behavior.

binary ensemble

Tcl 8.6 · Catalog source: live runtime snapshot python:3.12

0% shipped
0/2 shipped 2 next 2 explicit non-goals

Next

Textual base64 and hex decoding still has a useful plain-string contract.

  • decode

Textual base64 and hex encoding still has a useful plain-string contract.

  • encode
Explicit non-goals (2)
  • format Skip Binary packing and byte-oriented semantics do not generally fit Locutus' plain-value model.
  • scan Skip Binary packing and byte-oriented semantics do not generally fit Locutus' plain-value model.

info ensemble

Tcl 8.6 · Catalog source: live runtime snapshot python:3.12

0% shipped
0/2 shipped 2 next 24 explicit non-goals

Next

Runtime version reporting has a clean plain-value contract.

  • patchlevel
  • tclversion
Explicit non-goals (24)
  • args Skip Tcl introspection commands depend on runtime program state rather than plain values.
  • body Skip Tcl introspection commands depend on runtime program state rather than plain values.
  • class Skip Tcl introspection commands depend on runtime program state rather than plain values.
  • cmdcount Skip Tcl introspection commands depend on runtime program state rather than plain values.
  • commands Skip Tcl introspection commands depend on runtime program state rather than plain values.
  • complete Skip Tcl introspection commands depend on runtime program state rather than plain values.
  • coroutine Skip Tcl introspection commands depend on runtime program state rather than plain values.
  • default Skip Tcl introspection commands depend on runtime program state rather than plain values.
  • errorstack Skip Tcl introspection commands depend on runtime program state rather than plain values.
  • exists Skip Tcl introspection commands depend on runtime program state rather than plain values.
  • frame Skip Tcl introspection commands depend on runtime program state rather than plain values.
  • functions Skip Tcl introspection commands depend on runtime program state rather than plain values.
  • globals Skip Tcl introspection commands depend on runtime program state rather than plain values.
  • hostname Skip Hostname lookup depends on host environment.
  • level Skip Tcl introspection commands depend on runtime program state rather than plain values.
  • library Skip Tcl introspection commands depend on runtime program state rather than plain values.
  • loaded Skip Tcl introspection commands depend on runtime program state rather than plain values.
  • locals Skip Tcl introspection commands depend on runtime program state rather than plain values.
  • nameofexecutable Skip Tcl introspection commands depend on runtime program state rather than plain values.
  • object Skip Tcl introspection commands depend on runtime program state rather than plain values.
  • procs Skip Tcl introspection commands depend on runtime program state rather than plain values.
  • script Skip Tcl introspection commands depend on runtime program state rather than plain values.
  • sharedlibextension Skip Tcl introspection commands depend on runtime program state rather than plain values.
  • vars Skip Tcl introspection commands depend on runtime program state rather than plain values.

namespace ensemble

Tcl 8.6 · Catalog source: live runtime snapshot python:3.12

0% shipped
0/2 shipped 2 next 17 explicit non-goals

Next

Namespace string decomposition has a clean plain-value contract.

  • qualifiers
  • tail
Explicit non-goals (17)
  • children Skip Namespace mutation and introspection revolve around Tcl runtime program state.
  • code Skip Namespace mutation and introspection revolve around Tcl runtime program state.
  • current Skip Namespace mutation and introspection revolve around Tcl runtime program state.
  • delete Skip Namespace mutation and introspection revolve around Tcl runtime program state.
  • ensemble Skip Namespace mutation and introspection revolve around Tcl runtime program state.
  • eval Skip Namespace mutation and introspection revolve around Tcl runtime program state.
  • exists Skip Namespace mutation and introspection revolve around Tcl runtime program state.
  • export Skip Namespace mutation and introspection revolve around Tcl runtime program state.
  • forget Skip Namespace mutation and introspection revolve around Tcl runtime program state.
  • import Skip Namespace mutation and introspection revolve around Tcl runtime program state.
  • inscope Skip Namespace mutation and introspection revolve around Tcl runtime program state.
  • origin Skip Namespace mutation and introspection revolve around Tcl runtime program state.
  • parent Skip Namespace mutation and introspection revolve around Tcl runtime program state.
  • path Skip Namespace mutation and introspection revolve around Tcl runtime program state.
  • unknown Skip Namespace mutation and introspection revolve around Tcl runtime program state.
  • upvar Skip Namespace mutation and introspection revolve around Tcl runtime program state.
  • which Skip Namespace mutation and introspection revolve around Tcl runtime program state.

package command family

Tcl 8.6 · Catalog source: manual inventory https://www.tcl-lang.org/man/tcl8.6/TclCmd/package.htm

0% shipped
0/2 shipped 2 next 8 explicit non-goals

Next

Version comparison has a clean plain-value contract.

  • vcompare

Version constraint checks have a clean plain-value contract.

  • vsatisfies
Explicit non-goals (8)
  • forget Skip Package loading and availability depend on the host runtime and install state.
  • ifneeded Skip Package loading and availability depend on the host runtime and install state.
  • names Skip Package loading and availability depend on the host runtime and install state.
  • present Skip Package loading and availability depend on the host runtime and install state.
  • provide Skip Package loading and availability depend on the host runtime and install state.
  • require Skip Package loading and availability depend on the host runtime and install state.
  • unknown Skip Package loading and availability depend on the host runtime and install state.
  • versions Skip Package loading and availability depend on the host runtime and install state.

Triaged as out of scope

chan ensemble Tcl 8.6
0/0 20 skipped
zlib command family Tcl 8.6
0/0 9 skipped