From: Tom Tromey <tom@tromey.com>
To: Kevin Buettner <kevinb@redhat.com>
Cc: gdb-patches@sourceware.org, Tom Tromey <tom@tromey.com>
Subject: Re: [PATCH] Remove uses of "eval" from gdb testsuite
Date: Mon, 15 Sep 2025 12:39:49 -0600 [thread overview]
Message-ID: <87frcnmufe.fsf@tromey.com> (raw)
In-Reply-To: <20250915111518.0cefd70b@f41-zbm-amd> (Kevin Buettner's message of "Mon, 15 Sep 2025 11:15:18 -0700")
>> proc dap_match_values {name d args} {
>> foreach {key value} $args {
>> - if {[eval dict get [list $d] $key] != $value} {
>> + if {[dict get $d {*}$key] != $value} {
Kevin> Is the {*} expansion needed here? I've looked at the callers of
Kevin> dap_match_values and the key is always a plain string, so the splatted
Kevin> version is equivalent to 'dict get $d $key'. The splat would only
Kevin> matter if 'key' could be a list for a nested dictionary lookup.
Yeah, many invocations use this feature, e.g.:
dap_match_values "argc in function" [lindex $obj 0] \
"body result" 3
Here 'args' ends up as the list {"body result" 3} and then the first
call to "dict get" is passed "body result" as the key -- but this is
trying to fetch a sub-key.
Tom
next prev parent reply other threads:[~2025-09-15 18:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-13 19:40 Tom Tromey
2025-09-14 15:28 ` Tom de Vries
2025-09-15 18:15 ` Kevin Buettner
2025-09-15 18:39 ` Tom Tromey [this message]
2025-09-15 18:44 ` Kevin Buettner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87frcnmufe.fsf@tromey.com \
--to=tom@tromey.com \
--cc=gdb-patches@sourceware.org \
--cc=kevinb@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox