Sujet : Re: misunderstaning of switch command
De : nospam.nurdglaw (at) *nospam* gmail.com (Alan Grunwald)
Groupes : comp.lang.tclDate : 24. Jun 2025, 11:44:10
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <103dvk1$1v0s8$1@dont-email.me>
References : 1 2 3 4 5
User-Agent : Mozilla Thunderbird
On 24/06/2025 10:08, Harald Oehlmann wrote:
Sorry, typo in my last post:
The "if" command takes his first argument and passes it to "expr".
Then, eval will do the variable expansion.
Correct:
-> Then, expr will do the variable expansion.
Just one additional trick for a Tcl newbie to consider...
The OP had several lines like
$::SAME_AS_PREV { puts "unchanged \"$filename\"" }
which have now morphed (typically) into
if {$kind eq $::SAME_AS_PREV} {
puts "unchanged \"$filename\""
I have got into the habit of using the [format] command to build strings that have fixed and variable parts - it's kind of analagous to sprintf in C. This would lead me to change the output command to
puts [format {unchanged "%s"} $filename]
I believe it's easier to make out what's going on without all the backslashes that are otherwise needed around the quotes that surround the filename. (You can't exchange the outer quotes for curly brackets because that would prevent the Tcl interpreter from expanding $filename.]
Hope you find this helpful.
Alan