DGP Just a few notes on terminology. You refer to functions and user defined functions. In the Tcl world, we normally speak of commands and procs instead. Sometimes we even use the whole word and speak of procedures, but when we speak of functions, we usually mean something like sin() that belongs inside an expr.There are some introspection commands that operate only on procs -- info args and info default -- that give you information about a proc's syntax expectations.There is no corresponding introspection for a general Tcl command. It is conventional, however, for error messages to include such a summary. For a simple example:
% set wrong # args: should be "set varName ?newValue?"And of course you can always consult the DESCRIPTION section of the commands documentation.
KPV To reiterate a point made by DGP above: error messages are often invaluable to quickly learn the correct syntax, especially for figuring out the available options to a given command or widget. But you often have to give it the right kind of error to get the informative error message back:
% string wrong # args: should be "string option arg ?arg ...?" % string xxx bad option "xxx": must be bytelength, compare, equal, first, index, is, last, length, map, match, range, repeat, replace, tolower, toupper, totitle, trim, trimleft, trimright, wordend, or wordstart % canvas .c .c % .c wrong # args: should be ".c option ?arg arg ...?" % .c asdf bad option "asdf": must be addtag, bbox, bind, canvasx, canvasy, cget, configure, coords, create, dchars, delete, dtag, find, focus, gettags, icursor, index, insert, itemcget, itemconfigure, lower, move, postscript, raise, scale, scan, select, type, xview, or yview