Skip to content

Built-in Commands

Feather provides a comprehensive set of built-in commands that implement Feather's core functionality. The commands listed here mostly match the commands implemented by TCL.

Subtractions from TCL

  • Feather does not support arrays, because they were essentially supplanted by dicts.
  • There are no built-in I/O functions provided by Feather, as this is a responsibilty of the host.
  • There are no OO functions provided, because these encourage programming in the large.

Additions to TCL

  • The info command supports type and methods subcommands to get access to the internal representation of a value, and the methods exposed on foreign objects.
  • The usage command provides declarative CLI argument parsing with automatic help generation.

Control Flow

Commands for branching and looping:

  • if - Conditional execution
  • for - C-style loop
  • foreach - Iterate over list elements
  • while - Conditional loop
  • switch - Multi-way branching
  • break - Exit a loop
  • continue - Skip to next iteration

Variables

Commands for managing variables:

  • set - Get or set variable value
  • unset - Delete variables
  • append - Append to variable
  • incr - Increment integer variable
  • global - Access global variables
  • variable - Declare namespace variables
  • upvar - Reference variables in other frames

Lists

Commands for list manipulation:

Strings

Commands for string manipulation:

  • string - String operations (length, index, range, match, etc.)
  • concat - Concatenate arguments
  • join - Join list elements into string
  • split - Split string into list
  • format - Printf-style formatting
  • scan - Parse string with format
  • subst - Perform substitutions

Dictionaries

Commands for dictionary (key-value) operations:

  • dict - Dictionary operations (create, get, set, exists, keys, etc.)

Procedures

Commands for defining and calling procedures:

  • proc - Define a procedure
  • apply - Apply anonymous function (lambda)
  • return - Return from procedure
  • tailcall - Tail call optimization
  • uplevel - Execute in caller's frame
  • rename - Rename a command

Exceptions

Commands for error handling:

  • catch - Catch errors
  • try - Advanced exception handling
  • throw - Throw exception
  • error - Raise error

Evaluation

Commands for evaluating expressions and scripts:

  • eval - Evaluate script
  • expr - Evaluate mathematical expression

Introspection

Commands for examining the interpreter state:

  • info - Query interpreter information
  • trace - Trace variable and command execution
  • namespace - Manage namespaces

Argument Parsing

Commands for parsing command-line arguments:

  • usage - Declarative CLI argument parsing with help generation