Deutsch   English   Français   Italiano  
<103dvk1$1v0s8$1@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: Alan Grunwald <nospam.nurdglaw@gmail.com>
Newsgroups: comp.lang.tcl
Subject: Re: misunderstaning of switch command
Date: Tue, 24 Jun 2025 11:44:10 +0100
Organization: A noiseless patient Spider
Lines: 35
Message-ID: <103dvk1$1v0s8$1@dont-email.me>
References: <103dnah$1tams$1@dont-email.me> <103do3k$1s2ei$3@dont-email.me>
 <103dom1$1tams$2@dont-email.me> <103dpb8$1s2ei$4@dont-email.me>
 <103dpu7$1s2ei$5@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 24 Jun 2025 12:45:21 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="2c33e89101c118b09e240ef485944b88";
	logging-data="2065288"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+Q8WXTvNUgBJQp9axQs+ZkLoe/AWXW7q0="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:/nOgrlUsWqReK58ePagGjjqPNS0=
In-Reply-To: <103dpu7$1s2ei$5@dont-email.me>
Content-Language: en-US

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