As a search of the Tcl wiki shows, attempts to add named-argument capability to the Tcl <i>proc</i> command have been around for several years.<p>My own <i>nxproc</i> extension is more comprehensive. (See wiki [0].)<p>The extension enables named arguments, regular positional arguments, and 'rest' arguments, <i>nxargs</i> and <i>nxunknown</i>. <i>Nxproc</i> also provides (optional) type-checking of procedure arguments. (Types: string, number, bool and enumerated. Enums are lists of values restricting what the arg can contain.)<p><i>Nxproc</i> supports TclOO with <i>nxcontructor</i> and <i>nxmethod</i> commands -- same feature set as "plain" <i>nxproc</i>. Also provides case-insensitive '-ci' variants, and runtime display of named-argument default/actual values and types.<p><i>Nxproc</i> is a Tcl C extension. Bundle has Windows, Linux binaries. Compiles easily on other platforms.<p>[0] <a href="https://wiki.tcl-lang.org/page/nxproc" rel="nofollow">https://wiki.tcl-lang.org/page/nxproc</a>
The OpenACS web server toolkit has a lot of useful Tcl utilities, including the ad_proc procedure, which wraps proc and allows adding of switches, inline docs, and more.<p>I think it would be very useful to turn ad_proc into a built-in command and incorporate it into TCL.<p><a href="https://nstcl.sourceforge.net/docs/nstcl-core/ad_proc.html" rel="nofollow">https://nstcl.sourceforge.net/docs/nstcl-core/ad_proc.html</a>
I implemented something very similar a while ago, it's indeed too bad it's not built-in. I don't think you need such a "quasiquote" function, [list {*}$args] can escape a single command, and then it's a matter of joining multiple commands using a newline. IIRC that's how I did it.<p>I also had further fun with wrapping "proc" by implementing a "pyproc" which called out to Python while looking like a normal Tcl proc.
Synopsys tools (either CosmosScope or Custom Wave view) do it by the way of names following values. Like:<p><pre><code> measureFoo $signal threshold 0.9 edge last</code></pre>