Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:122508 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 5C5381AD8F6 for ; Mon, 26 Feb 2024 20:24:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1708979098; bh=B+3Ae1bSzosPSNv8ohrtjzSDATDrs3t51h7KG7s5yq4=; h=In-Reply-To:References:Date:From:To:Subject:From; b=JuHZhQ6chGZSVPe4KTaAeqaeyssDJRah2X5bu4H7o31PxOxrSN3y0oxJDqFhLxTyU QAOzlK79SmHJqU1EC3qNQs6rchOSut+W1Bw4yAafJ+wJHewik6d/HNgwjkHhDpjZYO PiupT4Mv0/hV79/HvRs+NMtFcUF316K9+BgasKxepdySOSIKSP8RUUBpvSzneXBfdo PaRDbpFl835paJ26BZU4Go2f4V5b/Ol/kHh9M3WvlIAidaqBUcrMtRJoJmrFWdS+au 1pyxnx9JIv2iPV9ssSv8cYP77dQ3rmca1fFfR3mbpbmBnXJrjpUZBC7vlZJtrIhR0J kMJFoPuA33eow== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 78925180BB8 for ; Mon, 26 Feb 2024 20:24:56 +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.9 required=5.0 tests=BAYES_40,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,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 out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) (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, 26 Feb 2024 12:24:54 -0800 (PST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id DE0A85C007F for ; Mon, 26 Feb 2024 15:24:45 -0500 (EST) Received: from imap50 ([10.202.2.100]) by compute1.internal (MEProxy); Mon, 26 Feb 2024 15:24:45 -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=1708979085; x= 1709065485; bh=vmPkurc3xaibNAIUpoQUJybmyPGbaK0nP98X7XeLmrg=; b=e shKLcw1fYPMoF7O8OnxkQqXQSldPet4ZiDMn94jGkw3XaNRVKXiZFcn/edWUbnWh qKD4XnSJGIA6zuv2/h7sU13U9z2G5ULEXkjQTuTOVeeANSv/wy5YE1MlfC2nPIvj XYEf1dyHQ0SKi6u+Ar3vjmx1byzFPVt1n6LUb9SPpsBUHh3uiY34atDOh60VomjK zDfuVbLW9L3WDZ03sAlV2qTN+1Np38ZgRXtcg8dsarjoVzeIjyZYIihvmnZrokFR Jc8jVOFY3bDZmhZMOhP3MAhYRZpxaCvjbpmZfv3ftmNQe+RCnWLuiSS799Ds8WqM w29XaBpbm42oOK76AuBAQ== 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=1708979085; x=1709065485; bh=vmPkurc3xaibNAIUpoQUJybmyPGb aK0nP98X7XeLmrg=; b=INf860m6CjojuajemLG66tgOZ7dBOVMQkIO5PnbXFF6m epBWWKS7XO6pS5pBbvGkq8ye9KKGx4oNvLQTN/MiF7nvtKxXFhjre8YNX2ZXee3H PdZ97C7Ycoh12H7By/LEoWHAfYncnL4eqVbQ42qkwUJVvoUAh8IGgSA4SsLB7nGm wwFSD9mo1Q0SEZ63u2v2g8rEeHw+UJffiI31tETfX7H44VOsbcklYpy3YVMeLc1j TpVfj9owMUED9FYSSCZgyhoC3c4mOkluIvKMmemM+y07Z/opunLY38kaBwY8U6dY VFZnz+INN2dqZcJI9ClqExsPeJqfDDZXnQN5tv1qDA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrgedvgddufeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgesthdtredtreertdenucfhrhhomhepfdfnrghr rhihucfirghrfhhivghlugdfuceolhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtoh hmqeenucggtffrrghtthgvrhhnpeevheehvdevjeelvdevgfelvefftdejkeelvdekgeeh fffgiedvjefhhfeltdduteenucffohhmrghinhepphhhphdrnhgvthenucevlhhushhtvg hrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehlrghrrhihsehgrghrfhhi vghlughtvggthhdrtghomh X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 9B3DE1700096; Mon, 26 Feb 2024 15:24:45 -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: <7b14a392-b673-4162-9a5b-dfb68657e633@app.fastmail.com> In-Reply-To: References: <790b5b4e-f51b-4050-a12a-5fa903d0568f@app.fastmail.com> <52C6F501-8E23-42D7-8541-88A22AD79375@koalephant.com> <36e90d8d-d275-4ce9-9dd9-1e2422c6d3a9@app.fastmail.com> <2fdf1933-b51c-40cc-8d02-31899b96c71c@genkgo.nl> Date: Mon, 26 Feb 2024 20:24:24 +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 Mon, Feb 26, 2024, at 7:39 PM, Rowan Tommins [IMSoP] wrote: > On 26/02/2024 19:02, Frederik Bosch wrote: >> >> That's how it always has been, no? So in your example, short code >> abbreviated form would not work. One has to write a block. >> >> public string$fullName { >> set=> [$this->first, $this->last] = explode (' ', \ucfirst ($value)); // error, $fullName is a string, returning array >> } >> >> public string$fullName { >> set{ >> [$this->first, $this->last] = explode (' ', \ucfirst ($value)); // no error, not returning >> } >> } > > > I think the intention is that both the block and the arrow syntax would > have any return value ignored, as happens with constructors, for > example. Note that in PHP, there is actually no such thing as "a > function not returning a value", even a "void" function actually returns > null; so if the return value was treated as meaningful, your second > example would give an error "cannot assign null to property of type string". This correct. Given a function test(): $ret = test('Larry Garfield'); There's no way to tell if $ret is a possibly-null value we should do something with, or null by side-effect. The RFC right now takes the stance of "it's null by side effect, always, so we never do anything with the return so it's consistent." > However, as noted in a previous message, I agree that the short form > meaning "the value returned is saved to the backing field" is both more > expected and more useful. You're the first person to comment on it, but I'm glad you agree. :-) I like it, but Ilija is still unsure about it. > The "yield" idea is ... interesting. I think personally I find it a bit > too magic, and too cryptic to be more readable than an explicit > assignment. Opinions may vary, though. > > Regards, Mixing in syntax only used for generators here seems like it's asking for trouble. It wouldn't actually be a coroutine, so using coroutine like syntax would just be confusing. It's confusing to me whether this implies the hook becomes a generator or not, which means it's likely to confuse a lot of other people. --Larry Garfield