Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128109 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 lists.php.net (Postfix) with ESMTPS id ACA731A00BD for ; Fri, 18 Jul 2025 13:04:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1752843784; bh=/F5ii/0k2ADB1NB4mzQnG9kcCewemC54ccrIoB7Txy8=; h=Date:Subject:To:References:From:In-Reply-To:From; b=czLHH0QxpV5E+rptbpZ291hXGPJmN3SCctbIy+Dsvad0IFNvs0ITuCvPw0H1dB/LZ BdkzAYFQONgnadJTPbPtDfeHQYmPhSG27ellic72t2Rq7h0RvAje3Jq1Jgv89z26Tk wYRhbuiCfHoyj5i3C5MMvp907ILVl2CzszLt3C9Ed0Q4pGw2q9uoF0NM5o2H0O6fBp CN0sXbVznwfijH71R9vK4r3iTI/E3UmPfWLQDDERP3YNGGAmoq4NejFo+Cu72nCkjk p042BZudz6YjYF8ngrM00N9/JE2xw9WYzoEsnIaEqX7BT3d5ISDY1IIgRmsvb0qRIC z0shl/xGBSZJQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 942C818055D for ; Fri, 18 Jul 2025 13:03:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from chrono.xqk7.com (chrono.xqk7.com [176.9.45.72]) (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 ; Fri, 18 Jul 2025 13:03:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1752843887; bh=ay5lBnVsvbYHzTrM6628KW5fSKvpmkPYEJM4RYNlPmo=; h=Message-ID:Date:MIME-Version:Subject:To:References:From: In-Reply-To:Content-Type:from:to:cc:subject:message-id; b=OMMpq8Iuxhy+u5TLdP4tZtlh3hxW87EIPLZVMYootKGytsLb9P/n2FkdxXn+YTfSu 74jKAp49Lw1FCRLBU3gp4BVmsMoFWsEj8/+siPRT1fB1WeaZzwBVSX7sIY624H9u7j 5kld3X5rIxSDpJtYPZ2ZnRzDRgowVok881++rhOiwBAq4S28zSOK8nDHPLqE5Qta7d T3EczqZ5tomhhqS8M2aaxfwAjrX+rQPwFh8YQGpNewO9Ha4gBj9Xkz37Ui6XEva3e9 Doid8bfBG78ymvGHU1q6/jbpvsYdBB6IPWlI6W9R0ksfVvZ+uNznv5JICkJde3NOQ3 aYpjMbzuXz8zw== Message-ID: <00f8137b-2760-4caa-97ca-1bc7c1195a0e@bastelstu.be> Date: Fri, 18 Jul 2025 15:04:46 +0200 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Subject: Re: [PHP-DEV] [RFC] Readonly property hooks To: Larry Garfield , php internals References: <1e8634d7-ac1a-4025-b4e2-1948aabf5251@app.fastmail.com> <6acab95a554fe5e188364840ea36d2b7@bastelstu.be> Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit From: tim@bastelstu.be (=?UTF-8?Q?Tim_D=C3=BCsterhus?=) Hi On 7/10/25 17:34, Larry Garfield wrote: > Nick previously suggested having the get-hook's first return value cached; it would still be subsequently called, so any side effects would still happen (though I don't know why you'd want side effects), but only the first returned value would ever get returned. Would anyone find that acceptable? (In the typical case, it would be the same as the current $this->foo ??= compute() pattern, just with an extra cache entry.) I'm seeing this proposal has already been dropped, but to spell it out explicitly: No, I would not find it acceptable for side effects to happen once again, but the return value ignored. And when dropping the "side effects run once again" part, you arrive at an 'init' hook, which I would be in favor of, since it would provide semantics that are sound with regard to user expectations. "Cached get" is just init with extra confusion. Best regards Tim Düsterhus