Newsgroups: php.internals
Path: news.php.net
Xref: news.php.net php.internals:122474
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 A16931ACEBF
	for <internals@lists.php.net>; Thu, 22 Feb 2024 19:53:25 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail;
	t=1708631610; bh=w66Kuh1tmWnzIllJJwoHI202IMZ0E4tE0y2OR0Gzk7A=;
	h=Date:Subject:To:References:From:In-Reply-To:From;
	b=Nt2rlh+x21Z8uLtdVjILercdcAXLSQDwaqMqTzV3ssdvLz3mW/GIDTjrF6GYp/yPx
	 syMJwQEqKOaED3cunfXD9R3FmEB/LGEP+2YXXrWYjslsEuyGLEJcJcXOFyVVRBpEYX
	 WomhxOT1PCgnHfmnQdOUDb08HWqDuUCDwClUAzC+ZgL2xS3ZAAt0cCmfZvDN86wW3V
	 eiqBIH2wWodOPPuxe33zKIhx7u2qMda14lwOVcUFXiqpsze4Svwt4DvPeNJ6867eGo
	 RR2Dbyoj1QCut6uJaPg7th2luevT94DtbjlxdeigM+p3F8ZZ5V1NupVLKaFwgKYIfz
	 WN+ISs1ywrtZQ==
Received: from php-smtp4.php.net (localhost [127.0.0.1])
	by php-smtp4.php.net (Postfix) with ESMTP id E1284180690
	for <internals@lists.php.net>; Thu, 22 Feb 2024 19:53: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.6 required=5.0 tests=BAYES_50,DKIM_SIGNED,
	DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,SPF_HELO_NONE,
	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: <tim@bastelstu.be>
Received: from chrono.xqk7.com (chrono.xqk7.com [176.9.45.72])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by php-smtp4.php.net (Postfix) with ESMTPS
	for <internals@lists.php.net>; Thu, 22 Feb 2024 11:53:28 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be;
	s=mail20171119; t=1708631600;
	bh=vaR5Gkajy8LOy7eHhGzqpmv4PWaoFwEE6Hm9tIvAdjE=;
	h=Message-ID:Date:MIME-Version:Subject:To:References:From:
	 In-Reply-To:Content-Type:from:to:cc:subject:message-id;
	b=C48TkVAvQ5VzKfeTB1HeV2/T2FUl9kF5neLoZHQp0X0uTPXDpcjso1dQRppy1LYBO
	 4KlBQJnTFParKdwiElbbYqeK8kaRmlMWF37xLeuVzEgZD99G/F4JkYVdwuBhdcAGYl
	 vL/tfLHIgj8ibjAWWqpypIqyCVCpEJcmysR9YrIYeNgbqC9bvf2Y1Olwa2M8er8m1K
	 qMCGwx+uIyuJ8esVuL0kOFxGa5YH+AfETHXF499MX2TcUnAO/mcHa+TGyfxCgMmGvI
	 ae/CBdaEmDoPonEfpC6aqvzQeeAFeUxOibPIz5fp27rnwDUMWVRxSa9pVAITsPdKOR
	 FaS+g41WXgqbg==
Message-ID: <a4c62d60-63af-45f0-843b-a39646b7bbed@bastelstu.be>
Date: Thu, 22 Feb 2024 20:53:17 +0100
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
Subject: Re: [PHP-DEV] [RFC[ Property accessor hooks, take 2
Content-Language: en-US
To: Larry Garfield <larry@garfieldtech.com>,
 php internals <internals@lists.php.net>
References: <fca97d6c-d4ec-4000-958a-72c32beb8421@app.fastmail.com>
In-Reply-To: <fca97d6c-d4ec-4000-958a-72c32beb8421@app.fastmail.com>
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

1. I believe there is an error in the "Final Hooks" section:

 > // But this is NOT allowed, because beforeSet is final in the parent.

I believe it should be s/beforeSet/set/.

2. In the same section this sentence is probably grammatically incorrect.

 > Declaring hooks final on a property that is declared final is 
redundant will throw an error.

3. Regarding the same sentence I also don't see why that should be 
disallowed, even if it is redundant. It's also legal to define 'final' 
functions within a 'final' class. Which also brings me to the question: 
Is defining 'final' properties and 'final' hooks within a 'final' class 
equally disallowed?

4. Since the RFC was last discussed, the #[\Override] RFC was accepted 
and implemented (https://wiki.php.net/rfc/marking_overriden_methods). A 
short section on the interaction with #[\Override] would probably be 
helpful.

5. Not sure if I've asked it before, but have you considered making the 
parameter for ReflectionProperty::getHook() an enum?

On 2/21/24 19:55, Larry Garfield wrote:
> There’s one outstanding question, which is slightly painful to ask: Originally, this RFC was called “property accessors,” which is the terminology used by most languages.  During early development, when we had 4 accessors like Swift, we changed the name to “hooks” to better indicate that one was “hooking into” the property lifecycle.  However, later refinement brought it back down to 2 operations, get and set.  That makes the “hooks” name less applicable, and inconsistent with what other languages call it.
> 
> However, changing it back at this point would be a non-small amount of grunt work. There would be no functional changes from doing so, but it’s lots of renaming things both in the PR and the RFC. We are willing to do so if the consensus is that it would be beneficial, but want to ask before putting in the effort.
> 

Calling it hooks is fine and allows for future extension without 
renaming, should the need arise.

Best regards
Tim Düsterhus