Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:124889 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id 2C9E61A00B7 for ; Mon, 12 Aug 2024 15:49:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1723477863; bh=UNeVv6t14J4uiqCvmUpvl401xQuta6S+myCjNgc43HA=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=KogOr7uQgPyuU0vZPkxLVeQ4kDKm+H3MdMRnvq42h9lyOZzwFgGswncxAsuRlBxft 9hMtmBR8ZUundJ3rxGz6OVqV34+YTxzRU3b1O/o89cBLaRPX2g9jV2xaSUlmwnUk7G sR3B6Z8NmPSyn5d5jpELPY0uIBceyzXz3YiABK3ISXiO5JawIoICM4W/Qr/jt3o3aV 1YLOGvh3QN4xjtsalQ9kYxfTBnvsUBK6BQW7PbhH1yC0vx93KpGfwxeOVZ5S1REtIu etAjinIGf96SvZGiOnM0bY7d91PaQyQsEtEyqvfjdi/kO4VC3e/tq/FJ75UjrkKeOh PXOwNlbkvNH/g== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 1BC8D180069 for ; Mon, 12 Aug 2024 15:51:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-io1-f43.google.com (mail-io1-f43.google.com [209.85.166.43]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 12 Aug 2024 15:51:02 +0000 (UTC) Received: by mail-io1-f43.google.com with SMTP id ca18e2360f4ac-81fd520fe0dso179024939f.3 for ; Mon, 12 Aug 2024 08:49:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=datadoghq.com; s=google; t=1723477757; x=1724082557; darn=lists.php.net; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=kbnQYgLvNPC48g6uiO6Cze8m5KKVclGxffqsiF/VR6M=; b=VVIGQ4wG3DuQhnVvIJQ8Ql7USjJ+bTTmvr5KSquykfRm9XInlk5kZL2lfuvkpRXS2L n4jWS+vz2+cLIDzUSDfRl2GxPZpPLN9V+iEpgiJlimCARh6nPsih1PminJugL6kpXZ14 9H36Vngj7Oy4wt8ZJYjQZkwwRoeIJcsfzQQpA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723477757; x=1724082557; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kbnQYgLvNPC48g6uiO6Cze8m5KKVclGxffqsiF/VR6M=; b=P8k0qUIXI0K4xqa3tbmKCPUAX+V9o4YX2IvozC9+jxy1NhN6lSQ9mwubQ1NzSPWfp0 cHHv65lM/idijkSFtWwvkhXS+hOsFeI6X+KUL69eQz8qOCnpyYShYwr5mfOjgPpB5/As o1AK0D19kX4NEr697+K1c2KeTiZHALUhEGKk2H2biCveXyidCNxxjxEEkF+yTUmIJVYr JWGIxntjKQppqz/df7jNQ+P3ZnwmsAWj065XYlA+Y6r7syvbFeAUuffYpdDu7ciCgaBF dCMsi36tRXADm1sQWi9F9EZSxBOaknKz74Lk8xre9YYO882d3fL5WDZdR2c5hzH/V3hY BQjQ== X-Gm-Message-State: AOJu0YwWMC3pWovnjw156K1RV2pZzNzGyhn/Uftit4/4jvAISWM+ZykS rUVl+kgZK75kV6oiChggo1igpLuzIQ8fX0VBMVFeA4xwG6CFxXb0p3SVp8OY8GL3Tu3tRIbxgL0 LU7zCNToa0WZDSBRz9L0S7Rv0Fq1ynjPFsDz2hxcaGFuYgUlL X-Google-Smtp-Source: AGHT+IEU+qAfLUNqYvpOp0Tr7LKjEiFeyRnyxBbZPg95xMgGgTg/JLMkyxOhmnc1vCtC3Px7KO64WjoIXzIr3sH2+A4= X-Received: by 2002:a05:6602:6b0e:b0:7fa:b6c1:c35a with SMTP id ca18e2360f4ac-824c9a3ab46mr99526939f.12.1723477756986; Mon, 12 Aug 2024 08:49:16 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 References: In-Reply-To: Date: Mon, 12 Aug 2024 09:49:05 -0600 Message-ID: Subject: Re: [PHP-DEV] [DISCUSSION] C++ Enhancements in Zend API To: Lanre Cc: PHP internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From: levi.morrison@datadoghq.com (Levi Morrison) On Sun, Aug 11, 2024 at 4:54=E2=80=AFPM Lanre wrote: > > Hello, > > I=E2=80=99m considering adding some C++ enhancements to the Zend API. The= se changes would be encapsulated within `#ifdef __cplusplus` guards, so the= y wouldn=E2=80=99t interfere with the existing C implementation. The primar= y goal is to provide a nicer interface for extensions while maintaining com= patibility with C. > > Key points: > - **Struct-based Approach:** Everything will still use structs=E2=80=94no= classes or non-public/non-static members. > - **Isolation:** Any enhancements that can be isolated from the C impleme= ntation will be, and they will reside in a common `zend_api_cxx` header fil= e. > - **Proposed Enhancements:** > - Constructors and destructors, along with comparison operator overload= s for `zval`. > - Constructor overloads for common `zval` initializations. > - Member methods for common `zval` operations. > > I=E2=80=99m happy to implement and maintain these changes. Since this doe= sn=E2=80=99t affect userland, do you think an RFC is necessary? > > Also, if anyone has suggestions or ideas for this C++ API, I=E2=80=99d lo= ve to hear them. > > Cheers, > Lanre I am not opposed, but there are some logistics questions: 1. Since it's for extensions and not core, how will we be sure it is maintained? What will test it? 2. Since it's in core, and C++ is a rapidly evolving language, what will the required C++ version be? What would our policy be on updating it? 3. How will we be sure about edges around language mismatches in C and C++? For instance, they have different rules regarding unions, which we make liberal use of. 4. C++ has many features and some are controversial. Will any be disallowed such as exceptions? There is one part of C++ specifically that I think could be pretty nice if we can figure out all the details: compile-time evaluation of the string hash function. This could make dealing with well-known/compile-time strings easier.