public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Hannes Domani <ssbssa@yahoo.de>
Cc: Tom Tromey <tom@tromey.com>,
	 "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>,
	 "blarsen@redhat.com" <blarsen@redhat.com>
Subject: Re: [PATCH v2] Allow calling of user-defined function call operators
Date: Mon, 06 May 2024 10:31:22 -0600	[thread overview]
Message-ID: <8734quc36t.fsf@tromey.com> (raw)
In-Reply-To: <829989170.10609936.1714768529914@mail.yahoo.com> (Hannes Domani's message of "Fri, 3 May 2024 20:35:29 +0000 (UTC)")

>> IIRC the evaluation operations are all kind of complicated and
>> hairy... but it seems to me that the type of the chosen overload of
>> operator() would supply the type here?

Hannes> Here the overload of operator() is chosen based on the argument values,
Hannes> not the other way round.

Ok, I looked a little more and I see other paths pretty much doing the
same thing.  I don't really understand how this works if, say, a call
like this requires a pointer-adjusting cast to be done --
evaluate_with_coercion won't do this properly.  However, if there's a
bug here, it's probably reproducible some other way already.

>> However, the value API is convenient to use -- for example, this is what
>> makes operator overloading work in the Python API.
>> 
>> You can see the distinction with this patch by trying to call a
>> struct-with-operator() object from Python.

Hannes> Calling a struct-with-operator() object from Python does not work, because
Hannes> valpy_call directly calls call_function_by_hand.
Hannes> It would maybe be possible to also call evaluate_subexp_do_call there.

We'll probably just need a new value API if/when the time comes.

Tom

  reply	other threads:[~2024-05-06 16:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20240427163606.1780-1-ssbssa.ref@yahoo.de>
2024-04-27 16:36 ` Hannes Domani
2024-05-03 18:29   ` Guinevere Larsen
2024-05-03 18:51     ` Hannes Domani
2024-05-06 12:29       ` Guinevere Larsen
2024-05-03 20:06   ` Tom Tromey
2024-05-03 20:35     ` Hannes Domani
2024-05-06 16:31       ` Tom Tromey [this message]
2024-05-15 19:53   ` Tom Tromey

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=8734quc36t.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=blarsen@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=ssbssa@yahoo.de \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).