Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123936 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 3C5B91A009C for ; Thu, 27 Jun 2024 10:47:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1719485333; bh=p44abSZg6agkC1LiMkyl7FU1jZI3XSaTUCisggcE+Q0=; h=In-Reply-To:References:Date:From:To:Cc:Subject:From; b=mQrmj1zRODE934Xvaq8n9MIacAxAeqazsRBJlVyBuU6EFFGH4tTgApLjD5cz8+zHB MaYZCFfR+1vSNwBwtie6ZpgCK2a1MbNu9+ec71vQHyGoklBf+A3jxZjDQ8ybaemjLp 8A03vEalsdQcU4WcJWH448nbOV5vNRxUvXpILzdPTpL5HtrQEeBjKVB1RNgs+/qhmg aBJan8E5nXVFroxOmBfb8HD6az2Bgu8v1pFTNI6eM7Su2+HlfdVorEBCbUhQs4hqVP 59boHWJYIkBHoLgGgUGrdJAHsI2ysn1tmOaZAT+RLzrxbAnRy391iY8YWN807LiCma 3SjhBc4N/+BhQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 49165180F04 for ; Thu, 27 Jun 2024 10:48:53 +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,HTML_MESSAGE, RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from fout5-smtp.messagingengine.com (fout5-smtp.messagingengine.com [103.168.172.148]) (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 ; Thu, 27 Jun 2024 10:48:52 +0000 (UTC) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailfout.nyi.internal (Postfix) with ESMTP id 5AA201380603; Thu, 27 Jun 2024 06:47:34 -0400 (EDT) Received: from imap49 ([10.202.2.99]) by compute1.internal (MEProxy); Thu, 27 Jun 2024 06:47:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bottled.codes; h=cc:cc: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=fm3; t=1719485254; x= 1719571654; bh=p44abSZg6agkC1LiMkyl7FU1jZI3XSaTUCisggcE+Q0=; b=W RUHirdBFLp5A/uT6wxNK5vPRkv4CPqb5Monz+S5nGX8eDX9Tm/vVCOybABptdEna C09JIEnFyOiRYknCs1orfavTQyOpSYbE8sdWZ6CGyGCiI1IsqLs/wIX6h4P1A9QF LZr5Amw7Aez+TX+RePI6+uIT/NhgWZAEnuLr9+yBwP7qot6ztb72Q/IiT1udxTvv VmqXVrZJ6WTSXHBRNUhaNZu97c+YLtjarg/O8yBBx6Fw84B+pWXSl9dUCYSRwUEa Xe4Lm3JriM8Ayc0lheQG4FD2fbeZ1NC1LUo0Z7Sb8+Oy7qV+Qc4kja+MaxV4AOFY 60v0RHTXBunJKaWsaPPyA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc: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= fm2; t=1719485254; x=1719571654; bh=p44abSZg6agkC1LiMkyl7FU1jZI3 XSaTUCisggcE+Q0=; b=GU62NKTYWo0F4O23PfiHuGH30lLl9uI40GGpEglHHw99 FR3blD9efR4y7xAgfRE1EVf5spKU+0/FfYtjHsyCNd/8IHeljZ8ZZd8KkB19q4nu Ipg09vtNe+HaFRjZgaVcmXcZhil1CzYRtivfYTDANjY0+DSLz7WoB/mf/Zrxw7HL O21mpgN+D5KWGZwpgOHRJGjsS4F5ntJ7/x/KwTADadPfN48Ln3gwjmD18e05CqhK zCrUMI4OQHleZvBNN6JcMW4LNaK+0gYd/eOPPXmTzDgGUfFtO4pkzt0LYZXnw0P2 gbprzekTETOilMxkoyYpmzjVNqCrXNuMIjHmevI0AA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrtdeggdefvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenog fuuhhsphgvtghtffhomhgrihhnucdlgeelmdenucfjughrpefofgggkfgjfhffhffvvefu tgesrgdtreerreerjeenucfhrhhomhepfdftohgsucfnrghnuggvrhhsfdcuoehrohgsse gsohhtthhlvggurdgtohguvghsqeenucggtffrrghtthgvrhhnpeejkeeifeeljefggffg tdettdefkeduvddtteevudduheevvdefgeduvddtvdeuffenucffohhmrghinhepmhgrsh htohguohhnrdhsohgtihgrlhdpghhithhhuhgsrdhiohenucevlhhushhtvghrufhiiigv pedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehrohgssegsohhtthhlvggurdgtohguvg hs X-ME-Proxy: Feedback-ID: ifab94697:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id F418715A0092; Thu, 27 Jun 2024 06:47:33 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.11.0-alpha0-538-g1508afaa2-fm-20240616.001-g1508afaa Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 Message-ID: <9d441999-b493-4194-9081-49f7bbb5c659@app.fastmail.com> In-Reply-To: References: Date: Thu, 27 Jun 2024 12:47:11 +0200 To: "Marco Pivetta" , "Arnaud Le Blanc" Cc: "Levi Morrison" , "Nicolas Grekas" , "PHP Internals List" Subject: Re: [PHP-DEV] [RFC] Lazy Objects Content-Type: multipart/alternative; boundary=f76d3bac568f4f80bde0a8e387e979d6 From: rob@bottled.codes ("Rob Landers") --f76d3bac568f4f80bde0a8e387e979d6 Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable On Thu, Jun 27, 2024, at 12:32, Marco Pivetta wrote: > Hey Arnaud, >=20 > On Wed, 26 Jun 2024 at 21:06, Arnaud Le Blanc wr= ote: >> The proposed implementation is adding very little complexity as it's = not adding any special case outside of object handlers (except in json_e= ncode() and serialize() because these functions trade abstractions for s= peed). Furthermore all operations that may trigger an object initializat= ion are already effectful, due to magic methods or hooks (so we are not = making pure operations effectful). This means that we do not have to wor= ry about lazy objects or to be aware of them anywhere in the code base, = outside of object handlers. >>=20 >> To give you an idea, it's implemented by hooking into the code path t= hat handles accesses to undefined properties. This code path may call __= get or __set methods if any, or trigger errors, and with this proposal, = may trigger the initialization. Userland implementations achieve this fu= nctionality in a very similar way (with unset() and a generated sub-clas= s with magic methods), but they have considerably more edge cases to han= dle due to being at a different abstraction level. >=20 > Assuming this won't pass a vote (I hope it does, but I want to be opti= mistic): is this something that could be implemented in an extension, or= is it only feasible in core? >=20 > Greets, >=20 > Marco Pivetta=20 >=20 > https://mastodon.social/@ocramius >=20 > https://ocramius.github.io/ > =20 I really hope it passes, not just for your libraries but also for mine. = I'm looking forward to going on a deletion spree and having a nice stand= ardized proxy API. =E2=80=94 Rob --f76d3bac568f4f80bde0a8e387e979d6 Content-Type: text/html;charset=utf-8 Content-Transfer-Encoding: quoted-printable
On Thu, Jun 27,= 2024, at 12:32, Marco Pivetta wrote:
Hey Arnaud,
<= /div>

On Wed, 26 Jun 2024 at 21:06, Arnaud Le Blanc <arnaud.lb@gmail.com> wrote:
The pro= posed implementation is=20 adding very little complexity as it's not adding any special case=20 outside of object handlers (except in json_encode() and serialize()=20 because these functions trade abstractions for speed). Furthermore all=20 operations that may trigger an object initialization are already=20 effectful, due to magic methods or hooks (so we are not making pure=20 operations effectful). This means that we do not have to worry about=20 lazy objects or to be aware of them anywhere in the code base, outside=20 of object handlers.

To give you an idea,=20 it's implemented by hooking into the code path that handles accesses to=20 undefined properties. This code path may call __get or __set methods if=20 any, or trigger errors, and with this proposal, may trigger the=20 initialization. Userland implementations achieve this functionality in a very similar way (with unset() and a generated sub-class with magic=20 methods), but they have considerably more edge cases to handle due to=20 being at a different abstraction level.

Assuming this won't pass a vote (I hope it d= oes, but I want to be optimistic): is this something that could be imple= mented in an extension, or is it only feasible in core?
Greets,


I real= ly hope it passes, not just for your libraries but also for mine. I'm lo= oking forward to going on a deletion spree and having a nice standardize= d proxy API.

=E2=80=94 Rob<= br>
--f76d3bac568f4f80bde0a8e387e979d6--