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
typeandmethodssubcommands 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:
- list - Create a list
- lappend - Append to list variable
- lassign - Assign list elements to variables
- lindex - Get list element by index
- linsert - Insert elements into list
- llength - Get list length
- lmap - Map expression over list
- lrange - Extract sublist
- lrepeat - Create repeated list
- lreplace - Replace list elements
- lreverse - Reverse list order
- lsearch - Search list for element
- lset - Set list element
- lsort - Sort list
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:
Evaluation
Commands for evaluating expressions and scripts:
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
