Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:122481 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 215481ACEBF for ; Fri, 23 Feb 2024 20:38:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1708720709; bh=HswwxForfAHh65kA1S2+zkI9LHA5XdOjN762W4kkRC0=; h=In-Reply-To:References:Date:From:To:Subject:From; b=FT4zQDVvKTmuQEs99KN1h9JplLkPlc5QFdEYcBusIPeG60yLPY/sLJ4kBPQwDlGTT iq9EfiZkGazoAxBOJb3Yy2xuZeAlxDlAmqi9+fZzJl+gVDd7eaXS3M282BjRHByGvV CRbwDOr/FDY8OUW3wGJUuqNU0fzu6q2UJSyaOa3pFMQHPU4ejeDQgvMavezwmQ9Clf EguM2j8GnrhyPzR85zZBlI+uIKkX+TfgScfgMns9lwQHzoUNySSd6IJD9OW+FHfYWq 2A/LM36dSr7foeSq28BPAs93JShIGNlmSmglvHDfozjoOhUZgjMl7eoszcxdcZhaF0 huM6hIss5FsMg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id DFDB8180004 for ; Fri, 23 Feb 2024 20:38:28 +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_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_NONE, 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 wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) (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, 23 Feb 2024 12:38:28 -0800 (PST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id 07FC23200A5F for ; Fri, 23 Feb 2024 15:38:19 -0500 (EST) Received: from imap50 ([10.202.2.100]) by compute1.internal (MEProxy); Fri, 23 Feb 2024 15:38:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= garfieldtech.com; h=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=fm1; t=1708720699; x= 1708807099; bh=g1rrhdTngg3g8G98c6mQw/fLP4Z6XZTmNC3a9mh2bjo=; b=P lpp7x1H/9F2STxwziunRlbO/qBs4Pbd8FhR4Ljyo0hOOG856HBtliXFcfHVjcI4l tjzTJ3HceACV/YveD2LQlmiE7HScvMYcoHmx6F3EigEuYNdrSKZ01nEgcpqcTn57 3Abb1r+yoWx43+Vqk+3+8hnCrfWeMaI4dLaS8hEaRfcB4gB+XNWm9vGMkZgOZVnN GWb+FBewgHWAjj9nDxKGLWjmOcdCTAmvQ9E763zM5I0rA6PCnmoE+YdGLdpCYR1M SHpzSzZES4LLuzChcbLPEqYdLmIHv4L0va5iLyQ1Ky1aSWaHqpc5LGGwIjZT7ub5 u0C+lw0xQ21rY4HCwxlFQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=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= fm1; t=1708720699; x=1708807099; bh=g1rrhdTngg3g8G98c6mQw/fLP4Z6 XZTmNC3a9mh2bjo=; b=L8xKY2m1a5b8dNuNL/vQVhcJPXSdMA3NHZ2iUOc8oloT wCyymFm2XwRx9dEHFbTz37B7TaUG+ZMchhilXScMIDesi5Zg+aM8WK5iuhtcIO7J KKsECAskJg+muidL2vG+aoh4uou3GgQjBYUVd6zg62t5AtLT8ws4+IpUtGhzutCo NOUaERnB0I/gQUwLoG1RLCyz952yZ54TGSKGr6shGl1/xg5+DmEA88Z6EQ+7bACQ 4qOs25ha1+7Cnl67ssdYLP4+A8eNE4vIeUUM+gMZv5brjBR+Pqq0CCSoyXe6wtik qXfy190S61v2xw0vu2J1XiYWg2aA/rFxKdK+zkLONQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrfeeigddufeekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgesthdtredtreertdenucfhrhhomhepfdfnrghr rhihucfirghrfhhivghlugdfuceolhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtoh hmqeenucggtffrrghtthgvrhhnpeeglefgkeduiedvvdetffeujefftdfhjeeiveehgfff keduveektddvledvvdfffeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmh grihhlfhhrohhmpehlrghrrhihsehgrghrfhhivghlughtvggthhdrtghomh X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 166461700096; Fri, 23 Feb 2024 15:38:19 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.11.0-alpha0-153-g7e3bb84806-fm-20240215.007-g7e3bb848 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 Message-ID: <11e3cb04-fe63-4931-94f1-0ef2e414d309@app.fastmail.com> In-Reply-To: <8dddf382-6904-46d3-98e4-65cdc6892d31@mabe.berlin> References: <790b5b4e-f51b-4050-a12a-5fa903d0568f@app.fastmail.com> <8dddf382-6904-46d3-98e4-65cdc6892d31@mabe.berlin> Date: Fri, 23 Feb 2024 20:37:58 +0000 To: "php internals" Subject: Re: [PHP-DEV] [RFC[ Property accessor hooks, take 2 Content-Type: text/plain From: larry@garfieldtech.com ("Larry Garfield") On Fri, Feb 23, 2024, at 5:35 PM, Marc Bennewitz wrote: > Hi Larry, > > first of all thank you very much for this amazing work you two have been > done :+1:. > I'm also feeling that introducing magic variables isn't the best design > choice. > I read your section about "Why do set hooks not return the value to > set?" and I don't really agree. > > Let me explain ... > > 1. Virtual properties and technically all functions return a valid. > > I think it would me much less magic if property setters on virtual > properties declare a void return type. > This would make it very obvious that this is a virtual property even on > having to read complex setters. Making everyone type ": void" after every set hook, when we already know that's going to be the case, seems like a really bad developer experience. I talked with Ilija extensively about it, and there is no meaningful way to distinguish between "this method returned null" and "this method didn't return" from the call site in the engine. If we could, that would allow smarter detection of when it makes sense to use a return value. Hence my suggestion of allowing set-on-return only for the => form. > 3. ambiguity > > I actually feel that $field is ambiguous. What happens if you declare > `set($field) {}` ? Does such construct let the engine set the property > value immediately as the input value gets immediately assigned to the > property via $field? $field has already been removed. See previous email. --Larry Garfield