public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Matheus Branco Borella <dark.ryu.550@gmail.com>
Cc: gdb-patches@sourceware.org,  tom@tromey.com
Subject: Re: [PATCH v4] Add support for creating new types from the Python API
Date: Thu, 02 May 2024 11:03:09 -0600	[thread overview]
Message-ID: <87frv0du42.fsf@tromey.com> (raw)
In-Reply-To: <20240221181156.3144-1-dark.ryu.550@gmail.com> (Matheus Branco Borella's message of "Wed, 21 Feb 2024 15:11:57 -0300")

>>>>> "Matheus" == Matheus Branco Borella <dark.ryu.550@gmail.com> writes:

Matheus> Thanks for the review, I've got a few questions and things to add before
Matheus> I submit the v5, if that's okay.

Thanks.  I'm sorry about the delay on this, pinging was the right thing
to do.

>> Is the none case really possible?
>> It might be better to just throw an exception from the constructor or
>> during argument validation or something like that.

Matheus> Most of these fall under the same response, so I'll just reply to them
Matheus> all at once.

Matheus> When I was writing this patch, I had the following in mind:
Matheus>  1st - This patch was first written before GDB switched to C++17, so I
Matheus>        had no access to std::optional<>.
Matheus>  2nd - I felt like throwing an exception over doing the `->valid()`
Matheus>        check explicitly would be less clear about my intent for people
Matheus> 	   reading the code.

Matheus> The design of `type_storage_owner` follows from those, and I don't feel
Matheus> like changing it to use std::option<> or exceptions would be much of an
Matheus> improvement in readability.

Matheus> Would it really be that much of an improvement?

I took another look at the patch and I think I understand.  I agree,
this seems fine.

>> I think the uses of this could probably use TYPE_ALLOC instead.

Matheus> Isn't that only valid for `struct type`? I don't think I follow. Some of
Matheus> the allocations (and I'm pretty sure at least one has to) happen before
Matheus> the call to `init_*_type`.

Yeah, I see.  It still feels like some of this could be using
type_allocator or be pushed there, but it's not a big deal, I wouldn't
worry about it.

thanks,
Tom

      parent reply	other threads:[~2024-05-02 17:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-16  4:54 Matheus Branco Borella
2024-01-16 12:45 ` Eli Zaretskii
2024-01-16 17:50   ` Matheus Branco Borella
2024-01-16 18:20   ` [PATCH v4] Add support for creating new types from the Python API Matheus Branco Borella
2024-01-16 18:56     ` Eli Zaretskii
2024-01-16 21:27       ` Matheus Branco Borella
2024-02-06 18:20 ` Tom Tromey
2024-02-21 18:11   ` Matheus Branco Borella
2024-05-01 16:23     ` [PING] " Matheus Branco Borella
2024-05-02 17:03     ` Tom Tromey [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=87frv0du42.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=dark.ryu.550@gmail.com \
    --cc=gdb-patches@sourceware.org \
    /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).