Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: Paul Koning <paulkoning@comcast.net>
Cc: gdb-patches@sourceware.org
Subject: Re: [Python] Allow attribute references to gdb.Value objects
Date: Mon, 15 Aug 2011 19:09:00 -0000	[thread overview]
Message-ID: <m3bovqebki.fsf@fleche.redhat.com> (raw)
In-Reply-To: <3A56CC74-0A48-47E8-BBA2-6E2BEB2FB588@comcast.net> (Paul Koning's	message of "Fri, 12 Aug 2011 15:27:33 -0400")

>>>>> "Paul" == Paul Koning <paulkoning@comcast.net> writes:

Paul> It would be more natural to be able to reference fields of a
Paul> gdb.Value by the standard field (attribute) syntax, e.g.,
Paul> "val1.field2" as opposed to "val1['field2']".  The attached patch
Paul> does this.  It acts like the Python standard method __getattr__ in
Paul> that it first looks for a predefined attribute (such as "type"),
Paul> and only if that fails will it look for a value field with the
Paul> given name.  So val1.type means what it always did (and if you
Paul> want the "type" field of some structure value, you'd need to use
Paul> val1['type'] as before).

We considered this initially, but decided on the current approach
instead.  The current approach lets us add attributes to Value without
breaking any existing code.

Tom


  reply	other threads:[~2011-08-15 19:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-12 19:33 Paul Koning
2011-08-15 19:09 ` Tom Tromey [this message]
2011-08-15 20:30   ` Paul_Koning
2011-08-15 20:43     ` Tom Tromey
2011-08-15 20:54       ` Paul_Koning
2011-08-16  1:12         ` Daniel Jacobowitz
2011-08-16 10:48           ` Paul_Koning

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=m3bovqebki.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=paulkoning@comcast.net \
    /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