in it. Obvious examples include:
- Regular Expressions
- regexp, regsub, and others
- pattern matching
- whose language is also used in if, for, and while selectors
- adds specialties like %W substitution, + command prefix, break outside loops
- bind sequences
- e.g. <Control-Button-1>
- format/scan/binary format/binary scan
- clock format
- command indices can be specified as end-1 or $var+1 or similar.
- includes syntax for redirection and variable substitution
- | is a special syntax at the beginning of a file name argument
- Variable names
- as seen in the first argument of set, and lots of other commands. (disputed)
- item ids.
All of these are comparatively small and self-contained, and do not have far-ranging effects on the rest of the Tcl system. In this way, Tcl can be understood in pieces; it's not necessary to know the whole language in order to be able to program in it.
These can all be considered particular domain-specific language
: Some of these seem a little dubious to be called "languages". switch
takes a dictionary
of pattern-body pairs; how is this a new language? I'm also confused about the inclusion of string
- are all ensemble
s to be considered separate languages? The syntax for variables and namespaces used by set
and $, would also seem to be an essential part of the syntax of Tcl itself rather than being a separate little language. A syntax on its own doesn't make a language.Peter da Silva
: I don't think the lindex command index and other similar special cases really qualify as "languages" (and, really, some of them should be considered mistakes)AMG
, in a perverse mood: Maybe calling every command a separate "little language" is just a nice way of saying that their interfaces are inconsistent. Certainly I recognize that it's good we have little languages as opposed to the rigid structure imposed by a language like C
or (shudder) Java
, but that doesn't mean we should abuse this power to avoid worrying about making the standard library of commands self-consistent. (Yeah, yeah, I know the