Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:125513 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 3A4FB1A00BD for ; Wed, 11 Sep 2024 20:56:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1726088281; bh=jpxKjM7LhqQrYFdXclPXO4k7Mh+km1vXuKkJT/tttng=; h=Date:From:To:Subject:In-Reply-To:References:From; b=XhbD8Ye31bA+nC0rWTEcCLNJPsXy18WkEh81JHLijGCVB+19iON8W73N39u/VF9jg 1JQMwgDFFj0n3yhc9m1Gub5j1H5stBBxM0m/xbh+oFEiQV9UJOk9usKI0Dp/wwWA8x 1JF1aSqS85CNrdZ1TJ2htTJGxSA6LTzYBmY5AyCqn1IBVY/qMnznMP2KWB7KP1u5hl WMBtRak52ohCKKajzskfPkw0XVFdtc/eQ4csxoYbDqZnRfIaRK+XonH9iLzJ/Y0iCU o7JCLQFRQ/QQmvn1TZzy53OWasm/DmgPVc0e4VlbBPqYC6mxq/6a2rTVyaGBhb/Upm KDxkIXVOfIMDg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id C2A5418007A for ; Wed, 11 Sep 2024 20:58:00 +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.1 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from fout1-smtp.messagingengine.com (fout1-smtp.messagingengine.com [103.168.172.144]) (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 ; Wed, 11 Sep 2024 20:58:00 +0000 (UTC) Received: from phl-compute-01.internal (phl-compute-01.phl.internal [10.202.2.41]) by mailfout.phl.internal (Postfix) with ESMTP id BBAA213800A6 for ; Wed, 11 Sep 2024 16:55:57 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-01.internal (MEProxy); Wed, 11 Sep 2024 16:55:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rwec.co.uk; h=cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1726088157; x=1726174557; bh=jpxKjM7LhqQrYFdXclPXO4k7Mh+km1vXuKkJT/tttng=; b= GKb9s2URWISfCE4tpROQ0ENs4YbGFPzC4MbVNJq1LAgrdu+t1gKM+09V91O9qqj3 Q+4VkYRTSoGdYFuRa2Cy7ww5KMPBqw+pH/yy99LM2Uklh/WpPRaNGElQBHj+H4zD rKeAe0x3R4u2WJHsEU1C4slCxSrYKSyYDFEVNkrJxwhydtkkcHClN6GH/Jn8CYXl apUahSso545d6ZI4P8E9bRCWISC5I6sfIr0SsGFV7Es4PdHvpyqcmKbk+gnQ30f/ fUokcQFZ4nL8YN/F0Obr8Vhr+ogIRgjk8lbqMZIbjR1spUWnIkhFWUtaNLV4pqUd lbO/ZYduu4TTgwqVwSXBew== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1726088157; x= 1726174557; bh=jpxKjM7LhqQrYFdXclPXO4k7Mh+km1vXuKkJT/tttng=; b=C unuY7ah5Ka9MrqVsFcxIcCAItjvRg8CzWIC0n+hsaSNhG2mkZUqbeTQGv62gKdLT VNNcCFs+q72+1Ci/GE31W7CmWDapAupzIPXqg8JVmT8EBzB2GIONQKMhicyaf36t NkmIoMB/ZMLpIltFNjMfVkw9atHWKhhZkTw/yzkgfEGVNY38r91Qt5wMeytQqN87 bhJOfuS5cIscvRXo3+txK1ThtZO1ko5cplPPPkLueSsLiJN/bthl1a5vKwH5QAk6 boF751PMI5KjCzCuR3qNgyiGvtIf4dG5+TLQcyDd0mxYkd7VUGr9MH64EP6sOBGT 5YiCCKQE97YZTZ6ByQ0eA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrudejuddgudehgecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecunecujfgurhepfffhvf fufggjfhfkgggtgfesthhqmhdttderjeenucfhrhhomhepfdftohifrghnucfvohhmmhhi nhhsucglkffoufhorfgnfdcuoehimhhsohhprdhphhhpsehrfigvtgdrtghordhukheqne cuggftrfgrthhtvghrnhepheelffetiefgveduteefudegtdduveeludegueegleehiefh hefgtdekveevgfelnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepihhmshhophdrphhhphesrhifvggtrdgtohdruhhkpdhnsggprhgtphhtthho pedupdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehinhhtvghrnhgrlhhssehlih hsthhsrdhphhhprdhnvght X-ME-Proxy: Feedback-ID: id5114917:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Wed, 11 Sep 2024 16:55:56 -0400 (EDT) Date: Wed, 11 Sep 2024 21:55:52 +0100 To: internals@lists.php.net Subject: Re: [PHP-DEV] Zephir, and other tangents User-Agent: K-9 Mail for Android In-Reply-To: <8D420123-4ECF-48FD-A9C3-F80C60457A37@newclarity.net> References: <8D420123-4ECF-48FD-A9C3-F80C60457A37@newclarity.net> Message-ID: Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: imsop.php@rwec.co.uk ("Rowan Tommins [IMSoP]") On 11 September 2024 20:12:53 BST, Mike Schinkel w= rote: >> It also risks conflicting with a future language feature that overlaps,= as happened with all native functions marked as accepting string automatic= ally coercing nulls, but all userland ones rejecting it=2E Deprecating that= difference has caused a lot of friction=2E > >That is a little different in that it was a behavior that occurred in bot= h core and userland whereas only allowing operator overloading in core woul= d mean there would be not userland differences that could conflict=2E Historically, that's what we had for scalar parameters=2E All the way back= in PHP 4 (I think), the engine had a function called "zend_parse_parameter= s" (ZPP), which took the PHP values a user provided, and either converted t= hem to the desired C type, or rejected them=2E In effect, it allowed functi= ons defined in extensions to declare scalar typed parameters=2E Then in PHP 7, we added scalar type declarations for parameters in userlan= d functions, and had to work out how they fitted with those internal functi= ons=2E Part of the motivation for the strict_types toggle was to manage the= ir behaviour; and userland functions require explicit nullable types, where= as ZPP historically coerced nulls regardless=2E Anything we let extensions do could end up with the same dilemma later: do= we match userland to existing extension behaviour, change extension behavi= our, or live with an awkward inconsistency? >WebAssembly has a deny-by-default design so could be something to serious= ly consider for extensibility in PHP=2E Implementations start with a full s= andbox[2] and only add what they need to avoid those kinds of concerns=2E= =20 The problem is that second part: in order to be useful for writing a PHP e= xtension, what would we need to let through the sandbox? For some simple extensions, the equivalent of FFI would be enough: call th= is special function, and some code runs in the sandbox and spits out an ans= wer=2E=20 For others, you need something that's easier to trust than a native binary= , but also integrates tightly into the language to do things PHP code can't= do=2E Maybe it's possible, but how is not obvious to me=2E >I think that actually supports what I was saying; people would gravitate = to only doing in an extension what they cannot do in PHP itself, and over t= ime if PHP itself improves there is reason to migrate more code to PHP=2E = =20 > >But there can still be reasons to not allow some thing in userland=2E Som= e things like __toArray=2E I think there's ideas pulling in opposite directions here: on the one hand= , using the difficulty of building extensions as a deliberate "speed bump" = to avoid people using features "badly"; but on the other hand, wanting to r= educe the difficulty of building extensions=2E I think the latter is a more noble goal, and one way to help is to make it= less *necessary* to build extensions, by adding to the core language the t= hings you currently need extensions to do=2E Things like efficient string b= uffers and binary stream manipulation, or attributes and magic methods to o= verride object behaviour=2E Regards, Rowan Tommins [IMSoP]