From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from omta034.useast.a.cloudfilter.net (omta034.useast.a.cloudfilter.net [44.202.169.33]) by sourceware.org (Postfix) with ESMTPS id 598BA3858D20 for ; Thu, 2 May 2024 17:03:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 598BA3858D20 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 598BA3858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=44.202.169.33 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714669401; cv=none; b=dTkuIzt6OrnBxpbQMSvyemmMMieKp8oimXMnH9wHh2qDzxI8DNGpF+0NU7po6dVNv4IV8J8GYyTtc59iWl7MCETOBroyreYHY8YePOFVTvVDntvzIFW5JTUrpvgYBvaR/++M4i1ufvXUfFUuHgmtMD1UHNgCEiQPYPcKW1JdSGo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714669401; c=relaxed/simple; bh=PnPMf1bgejNPBWydjqh55Y2yfe7arGLH3mVb+V8FljE=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=uDuee5Y0bgaaF9ctushsNw7urKeO5Q6HxR3JPNo4jZpj+4JfcDHXZywoT+WuQXEsiTrUVx0PV/HW13h8t62yvUEEJaTuV4pVW+T1BYpQhLbpFy1388bUfmNQOshNSImMVkH3Qr06y0e+WtlWzIwjlgmUVYGVBkY/SbI/I0gHVwU= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-5002a.ext.cloudfilter.net ([10.0.29.215]) by cmsmtp with ESMTPS id 2O95se1xzxs4F2ZpvseOgQ; Thu, 02 May 2024 17:03:11 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id 2ZpusOC9lr1If2ZpuscIiR; Thu, 02 May 2024 17:03:10 +0000 X-Authority-Analysis: v=2.4 cv=BawT0at2 c=1 sm=1 tr=0 ts=6633c74e a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=TpHVaj0NuXgA:10 a=Qbun_eYptAEA:10 a=pGLkceISAAAA:8 a=NgG7eXT-ISPL3L4UQUAA:9 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:Date:References:In-Reply-To :Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=GyK6plZFjJIXz3xTZaYVay2+B1N65tdKuDMFHDvBw0I=; b=g8XQ1EP6v1bsL9Ej4Fwh/6W0tD ylguKxjfo1K400NZ+NUQvMkDWc3+4n2pZEnxYLIP33qZxRFszet9Qpnx5Tymt+cEa37WUDkv8T+tl 3M2Y0R3WjRp1MVEg60kpGBoEo; Received: from 97-122-86-252.hlrn.qwest.net ([97.122.86.252]:51708 helo=murgatroyd) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1s2Zpt-0017Jk-3D; Thu, 02 May 2024 11:03:10 -0600 From: Tom Tromey To: Matheus Branco Borella Cc: gdb-patches@sourceware.org, tom@tromey.com Subject: Re: [PATCH v4] Add support for creating new types from the Python API 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") References: <871q9pe9p4.fsf@tromey.com> <20240221181156.3144-1-dark.ryu.550@gmail.com> X-Attribution: Tom Date: Thu, 02 May 2024 11:03:09 -0600 Message-ID: <87frv0du42.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 97.122.86.252 X-Source-L: No X-Exim-ID: 1s2Zpt-0017Jk-3D X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-86-252.hlrn.qwest.net (murgatroyd) [97.122.86.252]:51708 X-Source-Auth: tom+tromey.com X-Email-Count: 2 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfEZqRxztqkxGhZWwzyz38U3fyxJas5UoPANwQ4jXKZ5PDGItuhkitd16RSGAzZoN97Y0VZ/PYtfJMNlXHr+BXtmei7SaOhXwIfjgfcKIK8UhFJzKcf/P 0Aty2//dT/qISHc0WIf9roPpKIsjKtupi1BEFrUwI4b8x6FA36bGxtxxmHXIGnn+ZRgfJEyZ4jPCStB71X2zSSId6+lsKe5G2/8= X-Spam-Status: No, score=-3015.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,JMQ_SPF_NEUTRAL,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: >>>>> "Matheus" == Matheus Branco Borella 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