Newsgroups: php.internals
Path: news.php.net
Xref: news.php.net php.internals:122504
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 B2C041AD8F6
	for <internals@lists.php.net>; Mon, 26 Feb 2024 19:39:23 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail;
	t=1708976371; bh=TgltGTwmB/P98TGF4M6rHM8rj9SHxYH0Upg4DBrFMFg=;
	h=Date:Subject:To:References:From:In-Reply-To:From;
	b=Vs7MKfoYqxwxBdD+JufPxoc0fiPTkbS1bF7F/4nxD5IyhUpXZmo+qr5iLZG8HVgsz
	 6JFJqRXnTPSUs+CqM2LtlhoikcuzruLnmWYY+mZ4F9/CdptmXvWt8Y+/ObOTwWdz27
	 l1/GX9YmKAc8MlssMYLvtfUHR9BLu4czyVwe1mWFRz7l+JMSnPWxJ/UZLKdUKHQdGz
	 HAGwwtvNtR3B18prdx7gFr5B8Xt567Xy8sRkgwyqg46XRPzkKBYd57ZvmwHC4/twUt
	 MOo76ApTuxHaC4Jp0zIOkY66UZxi9Qj5Y32Zsfafowj0ZEOqfCIFEgY6qqYNfoiJre
	 pFg2phdu5ao2Q==
Received: from php-smtp4.php.net (localhost [127.0.0.1])
	by php-smtp4.php.net (Postfix) with ESMTP id 1FF2F18007F
	for <internals@lists.php.net>; Mon, 26 Feb 2024 19:39:29 +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,
	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: <imsop.php@rwec.co.uk>
Received: from wout1-smtp.messagingengine.com (wout1-smtp.messagingengine.com [64.147.123.24])
	(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 <internals@lists.php.net>; Mon, 26 Feb 2024 11:39:22 -0800 (PST)
Received: from compute7.internal (compute7.nyi.internal [10.202.2.48])
	by mailout.west.internal (Postfix) with ESMTP id 647433200A57
	for <internals@lists.php.net>; Mon, 26 Feb 2024 14:39:12 -0500 (EST)
Received: from mailfrontend1 ([10.202.2.162])
  by compute7.internal (MEProxy); Mon, 26 Feb 2024 14:39:12 -0500
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=1708976351;
	 x=1709062751; bh=2wJYpe0Y2prbGyJ200tJu38ZJNerGQ1Y9lBIL4jrsxg=; b=
	c2nvYGleG00KiUEA9+caQ5u9qEIys7tfTEJHdkTXm/6x8S0upC7cYLma+IQP9TaQ
	Rft2BoZ6OG2K6FmejFXRGtKq1XNeAx83x/ICkwJs1cDo3blMLQRd4jK9SH28rbmP
	b+TQ3fz7UEHmyegiIwSE3cgvN9CQ33gXZ1UxV8hSKMvRf/djCx+jgX8uzSbxkvNN
	oCQJttJb99cTI5DJmFMtE4L2ybUNXQ66QepeUnQL6BhC47qA8cG5UC66R8EnTTUJ
	KdqLTZjWzvE9OEy5FvJV5NkaFxo3wzm31O/eKzm36AGiQqXt4yIgEYGMtu+WaQkN
	IMUnPsKJZrjD1uKWKQNk1A==
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=1708976351; x=
	1709062751; bh=2wJYpe0Y2prbGyJ200tJu38ZJNerGQ1Y9lBIL4jrsxg=; b=M
	H+VY34yj5AQERkQrIUUnQdCgGB2eQo7VGQ1+/VwU/yPjxEeT0PiVFiJ8m5a6eYjp
	feundGQed2k41hWiJZT50BTeEk/b+rCpyseNJcltHDqeAqXBavNPO1wo3qDuC2o1
	yXBweNliXy84oHkwxoDgBowIotOtnp/HTIVhw9Z1m6Hp+L7Vk9qikt8M09UCswjR
	MJqCSEH4ZNRz/vyDmhkC4oveXrZMRMCmqcF3Z+yXGiFXTE8jVC//Q9u08+5yxvYd
	54r7hsW75KqUkecoyzAhDsgzf1yo34BAeduewCHhqHuGHTABBYcUTpxCgcXcDBks
	FV09HZTC7y9FL/pZmOwlg==
X-ME-Sender: <xms:3-jcZfWdCIDVX9PLmFF8D-VI9QfJRHGrtjL6hLLv_ZJJL98bIVcG-A>
    <xme:3-jcZXl7Z539WIRplUFfi-CR_6CjFDkXLPrzMdARdsB8vjBTvw9MJ55rYVe2i59XN
    qzlvMtUpWmehaTkbuE>
X-ME-Received: <xmr:3-jcZbag6rbhMXmnlz20u-bj15GKvAJIbq9qPCZyxw_Fs3N1-BInXbaezUsYAGrUOJBoi_7_VH5FF1xHWMsUxcc6zN1hrit9zTKCtmyzilyx4BQISKtcPZ4I>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrgedvgdduvdegucetufdoteggodetrfdotf
    fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
    uceurghilhhouhhtmecufedttdenucenucfjughrpefkffggfgfuvfhfhfgjtgfgsehtje
    ertddtvdejnecuhfhrohhmpedftfhofigrnhcuvfhomhhmihhnshculgfkoffuohfrngdf
    uceoihhmshhophdrphhhphesrhifvggtrdgtohdruhhkqeenucggtffrrghtthgvrhhnpe
    fhleelteekveffgeeileetgffgvdelfeevuefgvdekkefhvdetfedufeeiheehfeenucff
    ohhmrghinhepphhhphdrnhgvthenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmh
    epmhgrihhlfhhrohhmpehimhhsohhprdhphhhpsehrfigvtgdrtghordhukh
X-ME-Proxy: <xmx:3-jcZaVd9e6KgfQhlBIEg33MGZ1b_aeXIOko87RsibyHwoJBeTfpuw>
    <xmx:3-jcZZnh-taJhPLXGbLt_zg7l6KLWT_ISDnge_r5uxG0GQ6Qmnb1fg>
    <xmx:3-jcZXcgdBeKI4uVLtaUhNad6LpGyWohsIh1xA8dFAPDHMwnsXpLKg>
    <xmx:3-jcZYveqrqmMtG9BkVNjC8d84jWgOOOzuPeiEl6iPPv4U1xTc6EaQ>
Feedback-ID: id5114917:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA for
 <internals@lists.php.net>; Mon, 26 Feb 2024 14:39:11 -0500 (EST)
Message-ID: <d4832238-7af4-4bd4-b8a1-8ab8d56d51d2@rwec.co.uk>
Date: Mon, 26 Feb 2024 19:39:07 +0000
Precedence: bulk
list-help: <mailto:internals+help@lists.php.net
list-unsubscribe: <mailto:internals+unsubscribe@lists.php.net>
list-post: <mailto:internals@lists.php.net>
List-Id: internals.lists.php.net
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PHP-DEV] [RFC[ Property accessor hooks, take 2
Content-Language: en-GB
To: internals@lists.php.net
References: <fca97d6c-d4ec-4000-958a-72c32beb8421@app.fastmail.com>
 <CAJp_myUayeQ=irpFUG0OrUj=PjE3_mx395h_ARSdLmdyEB6_EQ@mail.gmail.com>
 <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>
In-Reply-To: <2fdf1933-b51c-40cc-8d02-31899b96c71c@genkgo.nl>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
From: imsop.php@rwec.co.uk ("Rowan Tommins [IMSoP]")

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  <http://www.php.net/explode>(' ',  \ucfirst  <http://www.php.net/ucfirst>($value));  // error, $fullName is a string, returning array
>      }
>   
>      public  string$fullName  {  
>          set{
>              [$this->first,  $this->last]  =  explode  <http://www.php.net/explode>(' ',  \ucfirst  <http://www.php.net/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".

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.

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,

-- 
Rowan Tommins
[IMSoP]