From: Doug Evans <xdje42@gmail.com>
To: Siva Chandra <sivachandra@google.com>
Cc: gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH v19 1/4] Add xmethod documentation and NEWS entry
Date: Mon, 02 Jun 2014 03:59:00 -0000 [thread overview]
Message-ID: <m3mwdwdks0.fsf@sspiff.org> (raw)
In-Reply-To: <CAGyQ6gwMjY2D56+NCd51jUEhiXn9rzhSDsmt6NhcPGskL9tArA@mail.gmail.com> (Siva Chandra's message of "Fri, 30 May 2014 15:56:08 -0700")
Siva Chandra <sivachandra@google.com> writes:
> 2014-05-30 Siva Chandra Reddy <sivachandra@google.com>
>
> * NEWS (Python Scripting): Add entry about the new xmethods
> feature.
>
> doc/
> * python.texi (Xmethods In Python, XMethod API)
> (Writing an Xmethod): New nodes.
> (Python API): New menu entries "Xmethods In Python",
> "Xmethod API", "Writing an Xmethod".
>
> [...]
>
> +@node Writing an Xmethod
> +@subsubsection Writing an Xmethod
> +@cindex writing xmethods in Python
> +
> +Implementing xmethods in Python will require implementing xmethod
> +matchers and xmethod workers (@pxref{Xmethods In Python}). Consider
> +the following C@t{++} class:
> +
> +@smallexample
> +class MyClass
> +@{
> +public:
> + MyClass (int a) : a_(a) @{ @}
> +
> + int geta (void) @{ return a_; @}
> + int operator+ (int b);
The corresponding python method takes a MyClass object for "b", not an int.
Either they should match, or the docs should say why they're different.
[There's no reason the user can't add new methods to an object with
xmethods, but at the moment I think the reader will find the difference
confusing unless there's an explanation of why.]
> +class MyClassWorker_plus(gdb.xmethod.XMethodWorker):
> + def get_arg_types(self):
> + return gdb.lookup_type('MyClass')
> +
> + def __call__(self, obj, other):
> + return obj['a_'] + other['a_']
> +@end smallexample
LGTM with that fixed.
prev parent reply other threads:[~2014-06-02 3:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-30 22:56 Siva Chandra
2014-06-02 3:59 ` Doug Evans [this message]
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=m3mwdwdks0.fsf@sspiff.org \
--to=xdje42@gmail.com \
--cc=gdb-patches@sourceware.org \
--cc=sivachandra@google.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