Arguments to procedures are passed by position. The use of two element lists as a component of the argument list, e.g. {aa a}
, is to supply a default value. However as the manual says:
Arguments with default values that are followed by non-defaulted arguments become required arguments. In 8.6 this will be considered an error.
So, most people design their procedure interfaces to place the arguments that supply a default value at the end of the argument list.
One way to simulate named arguments is to design the procedure to take a single argument that is a dictionary value where the keys of the dictionary are the names of the parameters. For example,
proc foo {a} {
if {[dict exists $a cc]} {
puts [dict get $a cc]
}
}
foo [dict create cc "this is the cc argument value"]
If you don't mind the tedium of determining which optional parameters are supplied and the tedium of building a dictionary to invoke the procedure, then you can simulate named arguments this way and achieve some flexibility in supplying arguments to procedures. I don't use this technique very often myself. I find it easier to design the procedure interfaces more carefully. But sometimes the circumstances warrant all sorts of things.