Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123091 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 A8BBA1ADA9D for ; Wed, 10 Apr 2024 14:57:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1712761071; bh=YgaEkH9qtRuBLD9yI6Xq+3o25Trdc0NgBocLZpM9aMw=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=ZKtghmXiEZ4fbSDnGJtLYTCiiKfCouUNK5rtDuE9g137BYQHm+qG2KH7gHQ0K/JcF ABIQPakShHD3DOc+NlSfkxnOATjqLsGOU8ez+umhs9iOE4qdWAoVo5K3rcDtjCLUl1 O1/C3HzKzPGtmCMmX88X9W+hq91T4nMETzAb7YNJDGDpUTptBRKZbJ6UAgvmeIQYNw Ah/h8VP6yuk58b4AMUkaVVqC5DQyurnKNKSAERFbyIGgK5g2MqRRu60qLBIS7JFes7 VsgzCTCpojWTD2v6x0IkN2NMKCiZ7Mc4aexy0rzr45WOTffOdhuh0MlXkFZe47N3OI Fhm/XTn1o1L8w== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 634771801EA for ; Wed, 10 Apr 2024 14:57:48 +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,FREEMAIL_FROM, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com [209.85.167.53]) (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 ; Wed, 10 Apr 2024 14:57:42 +0000 (UTC) Received: by mail-lf1-f53.google.com with SMTP id 2adb3069b0e04-516d0c004b1so8113250e87.2 for ; Wed, 10 Apr 2024 07:57:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712761028; x=1713365828; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=MXAz0xJyBg9rFBp8coipN1ZcQ/A7fnAGJlfdPC+AWik=; b=SRtsqyuPc7zhqV8Hff0OgM7HXg0Oq01Dnk05MpOD2lA+KfPNY/irDm6xf8R+kZaFgj Fm1m9b3jJbCPo6y47/s6XwkzYVSoawPjuriO3/qbytLsrYgaPSKqTbvU8jNfw9CjgISE 9DHsSDTOpkWrLcQmhjKEjOixE/F0X9L3r1nzz75ZcwfVTvWSUvSacTeGgxtYPm/oVw8O 5wEPWvxlE9zze2oK4GynbIlImmqNcHmLt4hf5EKbuP3R/rrrv196Wn/SPBBEXt4SmE3V Qq4VsSaQ+54LSXRUuvUKR68POdoNM3sq/GRcGdAgchAWJv8zMEdmW8/Is1kx3IroeYyy 5UVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712761028; x=1713365828; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=MXAz0xJyBg9rFBp8coipN1ZcQ/A7fnAGJlfdPC+AWik=; b=EO3Fz703f3tV7H/EXom6JjxUPRdlyEQ1BTik7ZwbH4Z9r2QzCx2B+5aDDXuij5crz+ 0ofgDKMDWAyL0v93kMDkKKBvnvPTPFjyM9KmDrq6BI2nBbMpY3cdq9bsqP576Q5nkBzM 7N+eMt9R/WZjj8lHWQ+VrBrNScW0zz20csHSjuFR9581dL1NqV3m8Wg/0vLCuquVFj5b 0ul6A1iC89v2EvqcJn7/6l46wPINBLgRYmzygBuizImHyhradZFd1UdCK8sT53ucQIfU 7wLFwdN1ihDzWRTpMXtfPJ4FGONc7jEaxFBbPCrIHQa0R/+kNImNSCt4IIs3HvjZdwx0 NlHQ== X-Gm-Message-State: AOJu0YxEG1QkTAB1i4nuUKChfEPbU9zeZo7dLgbUB0xEozJK9mdZO4ek OHzqBLbNp5GN+RCDlsjPM8R9aCP/sV7WcTkxU/JGVl7XdjGHwlQ/TqijVb1Er3SSQpU4vQLAkqe QLTwA3KRnMekJ+VbaIjjsD0SfLkxo/VXSCVSWzQ== X-Google-Smtp-Source: AGHT+IEiaHak5p/cJR98Pc6OS+bt5jkKmUVQyyy7VDJlL3be1/6m6QTfFLrz4DHERnlZlxcbJD3ei2p/jg1dyauBuZ8= X-Received: by 2002:ac2:4318:0:b0:516:d18b:eaed with SMTP id l24-20020ac24318000000b00516d18beaedmr2293063lfh.30.1712761027906; Wed, 10 Apr 2024 07:57:07 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 10 Apr 2024 16:56:56 +0200 Message-ID: Subject: Re: [PHP-DEV] [RFC][Vote announcement] Property hooks To: Ilija Tovilo Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000a75c920615bf40d2" From: nicolas.grekas+php@gmail.com (Nicolas Grekas) --000000000000a75c920615bf40d2 Content-Type: text/plain; charset="UTF-8" Hi Ilija, Larry, Heads-up: Larry and I would like to start the vote of the property > hooks RFC tomorrow: > https://wiki.php.net/rfc/property-hooks > I would make 3 changes to the RFC if I were in charge : - I'd make $this->propName inside a hook access the parent property via its hooks if any. I'd do this because that'd provide encapsulation-by-default for inheritance. Aka a parent class could reasonably expect its child classes to get through its hooks. (I'd be fine with only allowing the "=" operator on this.) - I'd keep the special $field value to access the backing value. It's a clear way to signify that accessing the raw value is possible only in hooks, never in other methods. - And I'd consider forbidding any method calls in hooks except static methods. This would allow factorising functional logic without opening for side-effects on the object outside of hooks themselves. I'm sharing this in case it rings a bell somewhere, but I can work with the peculiarities of the current RFC and I must admit I didn't spend as much time as you on the topic so my proposals might fall short, while yours to actually work. Thanks for that :) I'm in favor of the RFC. Cheers, Nicolas --000000000000a75c920615bf40d2 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Ilija, Larry,

Heads-up: Larry and I would like to start the vote of the property
hooks RFC tomorrow:
https://wiki.php.net/rfc/property-hooks
<= div>
I would make 3 changes to the RFC if I were in charge :<= /div>
  • I'd make $this->propName inside a hook access the paren= t property via its hooks if any. I'd do this because that'd provide= encapsulation-by-default for inheritance. Aka a parent class could reasona= bly expect its child classes to get through its hooks. (I'd be fine wit= h only allowing the "=3D" operator on this.)
  • I'd = keep the special $field value to access the backing value. It's a clear= way to signify that accessing the raw value is possible only in hooks, ne= ver in other methods.
  • And I'd consider forbidding any method ca= lls in hooks except static methods. This would allow factorising functional= logic without opening for side-effects on the object outside of hooks them= selves.
I'm sharing this in case it rings a bell somewher= e, but I can work with the peculiarities of the current RFC and I must admi= t I didn't spend as much time as you on the topic so my proposals might= fall short, while yours to actually work. Thanks for that :)

I'm in favor of the RFC.

Cheer= s,
Nicolas
--000000000000a75c920615bf40d2--