From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by sourceware.org (Postfix) with ESMTPS id A12B63858C54 for ; Wed, 26 Apr 2023 06:34:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A12B63858C54 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 7667421A0C; Wed, 26 Apr 2023 06:34:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1682490878; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2sf2VbunsflkrwIKJPjp/5ki8Lqt24aIXvV3pRfmRw0=; b=gI9FkGEvPUnD/AypNSHHf8l/DWqAt1uWltfLX5G6o/2h+Qbmmo0lWtSlBJTz5hpOr5uQTT rdWvD8jIyO2OL3XoNI3Aok/PoR/+2Bf0tsWnNIzKboxGAPFmbIIXIHLo4SZWrf7nlo911I dlLSdOa2m/JmUTge4TWFPAwfAj9rpc0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1682490878; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2sf2VbunsflkrwIKJPjp/5ki8Lqt24aIXvV3pRfmRw0=; b=8+pa+FViFycMZPgxw7+KCzApbRsZlPIRUOGUPjNRj6NSdT4pifkAH31vkeRQfvCEBw4hxh cqCdmr5DxzUTBjBw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 60A70138F0; Wed, 26 Apr 2023 06:34:38 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id EHhJFv7FSGSiXAAAMHmgww (envelope-from ); Wed, 26 Apr 2023 06:34:38 +0000 Message-ID: <97d43c1a-45d2-6ec5-001f-e20709342ce3@suse.de> Date: Wed, 26 Apr 2023 08:34:44 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.1 Subject: Re: [pushed 1/4] [gdb/testsuite] Don't use string cat in gdb.dwarf2/dw2-abs-hi-pc.exp Content-Language: en-US To: Tom Tromey , Tom de Vries via Gdb-patches References: <20230424124846.29580-1-tdevries@suse.de> <874jp5z0n8.fsf@tromey.com> <2a3587b4-98c4-263a-7deb-9530fbf06c57@suse.de> <878refyfgn.fsf@tromey.com> From: Tom de Vries In-Reply-To: <878refyfgn.fsf@tromey.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 4/25/23 20:38, Tom Tromey wrote: >>>>>> "Tom" == Tom de Vries via Gdb-patches writes: > > Tom> +set sources [lmap i $sources { subst $srcdir/$subdir/$i }] > > Tom> My working set of tcl is a bit random, so I don't know what idiomatic > Tom> is and what not. > > No worries, Tcl expertise isn't exactly a headline skill. > > Tom> I agree that subst is neater since it needs less quoting. > > It probably has to be { subst { $srcdir/$subdir/$i } } > since otherwise there will be a second substitution if, say, the srcdir > has a $ or [] in it. OK, let's try an example. We currently have this style: ... set b d set l { a $b } set res [lmap v $l { expr {"$v/c"} }] foreach v $res { puts "V: $v" } ... which does: ... V: a/c V: $b/c ... Then with subst we have the same: ... set res [lmap v $l { subst {$v/c} }] ... unless we forget the quoting: ... set res [lmap v $l { subst $v/c }] ... which gets us instead: ... V: a/c V: d/c ... Hmm, in that case I think subst is the worse choice. With expr, things either parse or not, and if it parses you get the right result. FWIW, reading a bit more about it I get the impression also set is idiomatic, so I came up with this: ... set res [lmap v $l { set v $v/c ; set v }] ... which works as well. Thanks, - Tom