From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io1-xd32.google.com (mail-io1-xd32.google.com [IPv6:2607:f8b0:4864:20::d32]) by sourceware.org (Postfix) with ESMTPS id A69753858D33 for ; Thu, 16 Feb 2023 18:12:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A69753858D33 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-io1-xd32.google.com with SMTP id q3so972968iow.11 for ; Thu, 16 Feb 2023 10:12:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; h=mime-version:user-agent:message-id:in-reply-to:date:references :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=jIMOsta+IpXapDcwuzeMxAIEUsAvPnY88P9TlqZZJYc=; b=DKH2ziNG4u2wvXfafwve3KU+AALeWLFcbJw5xZ9jHOd9EPSdqotfUf0zwV+MUK0A7T b/uO/qczkHotBp3bJb0ougVzYrsPzfsB/V6e1KnLZu5Q/8g2JTlEoPGeOaYLy7l3U7m1 VwzgEIZwh2J+MB6m56c3kQVxFFXFnlLPH2PQMzRtOChBXvmlu4Curs7r9y/TkhRg+uUq Y6qT2PEI4ecP4i74K+AOiYx4Jl93b3YVRcBDfxqDtZ7QC8SizKGhoenA7gAX4eovRFvx aMTWTLBtlN+hV2Wew1s/zaM+Bp0kSXBqhmxIwI8HDxFiPq0z6jRbCronqS517SjT4g4c AeOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:message-id:in-reply-to:date:references :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=jIMOsta+IpXapDcwuzeMxAIEUsAvPnY88P9TlqZZJYc=; b=07yXRTf4CuBE6trJVWHFPFmKWwELM6PGgpX5K9iod95PC0GZ3uE8aAir23F5g8sPcu kvJ+WM3tvJlYfB54GLUfDfrztMbbXEMvXccNlmzP45R5pZNRfe6HxNjYy+9z71EC0LOY dX0T6mmeZWKL71FD8RiKsbzyQE51mL7a5IV566NYHSsEZatVYURVqhXbgb+TaVP+lGT/ 51wH9yFozwT/yO5fkR9TOWqD1oXqJx598q7W4IawZM0ySlcC7LVAKIkR6aqXJB1OFTQu oLhEUbt9JLprSEd9jWjur62Ur5XGwZgWDIrO2OxEcTHRm2YdtKlGIVvswhmRMXLK5Dbl 2MDA== X-Gm-Message-State: AO0yUKVLgLsDN0MWiwoERllra5Yx43q/u/PyfLTwnExRtr5SsEPSdDEM PcsrjBKXWqCdo4lKz7Zy7TUCHTKnZWT2gk6C X-Google-Smtp-Source: AK7set8SxAYfFiTROVLREYb/qarTDmurYiqs+LDQXiLOQzcKnH+D5RLIVxdPO/b5HTFWUqtm3eD+sg== X-Received: by 2002:a5d:8048:0:b0:71a:b85c:2995 with SMTP id b8-20020a5d8048000000b0071ab85c2995mr4614081ior.15.1676571164907; Thu, 16 Feb 2023 10:12:44 -0800 (PST) Received: from murgatroyd (75-166-130-93.hlrn.qwest.net. [75.166.130.93]) by smtp.gmail.com with ESMTPSA id x1-20020a0566022c4100b0073a658f7951sm671414iov.48.2023.02.16.10.12.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Feb 2023 10:12:44 -0800 (PST) From: Tom Tromey To: Simon Marchi Cc: Tom Tromey , gdb-patches@sourceware.org Subject: Re: [PATCH] Fix Tcl quoting in gdb_assert References: <20230215215828.1337884-1-tromey@adacore.com> X-Attribution: Tom Date: Thu, 16 Feb 2023 11:12:43 -0700 In-Reply-To: (Simon Marchi's message of "Thu, 16 Feb 2023 11:06:32 -0500") Message-ID: <87h6vlpjhg.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP 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: >>>>> "Simon" == Simon Marchi writes: >> - set code [catch {uplevel 1 expr $condition} res] >> + set code [catch {uplevel 1 [list expr $condition]} res] Simon> I don't understand why this would be needed. The doc of uplevel says: Simon> All of the arg arguments are concatenated as if they had been passed Simon> to concat "concat" is simple string concatenation, but "list" also supplies list quoting. Here's a simple example: % set text "hello Simon" hello Simon % uplevel 0 puts $text can not find channel named "hello" % uplevel 0 [list puts $text] hello Simon Or more directly: % concat puts $text puts hello Simon % list puts $text puts {hello Simon} Here you can see the result of the [concat] isn't a valid command. Simon> So, I'm not saying your fix is wrong, I am just saying I don't Simon> understand the situation. This part of Tcl has always confused people, you're not alone. But basically, for eval-like things you normally want to quote with [list]. I'm not totally sure why it works the way it does, but it might be because Tcl didn't have a "splat" operator in the early days, so un-quoting a list to write something like "apply" was more of a pain. Tom