Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:124190 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 DD4CA1A009C for ; Wed, 3 Jul 2024 12:28:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1720009780; bh=v56kaAlRsYI6y2O5XAjfbveEJT+IlwODQwpLllVkTRI=; h=From:Subject:Date:In-Reply-To:Cc:To:References:From; b=PavvthKSB7gcwxqd5egffHLCnq35gEyLjwkHqZ4TVyUx9KfGZRtPY1I9g4r6oHAqn ediNl88IK8QLw5WsupTBeG2WKkCAC6pMA8ZDcR7VS41KQxwAIx3yK0uS9TPyL1401q S/Rk7A29HWbd4PCgrc47btPe6vP4EfF5m0tb3o4JzMGozoKD1d4feHJced6ZxuFoCC jWJv44to+3ors3xIY/gXBJB8Xm+jTeEZn4jJhj7f6l9AqK859DW410ttLB8ATFb/mD Si52xQI6gFj0xxwdVKgOHYu+lv2TDXeBIA6CTS7EcqvOwvpyv2QdCxdIYF/OVr6U4v OUYO27L3iRp9w== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id E0514180039 for ; Wed, 3 Jul 2024 12:29:39 +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: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.46]) (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, 3 Jul 2024 12:29:39 +0000 (UTC) Received: by mail-ed1-f46.google.com with SMTP id 4fb4d7f45d1cf-57ccd1111aeso3816436a12.0 for ; Wed, 03 Jul 2024 05:28:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1720009697; x=1720614497; darn=lists.php.net; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=43sqLil+gkFHtxclLfMxbCmEVEXC+KGvLI39pYVnV5U=; b=QSpD/0OEheAaQ/FU/6DavU7uXta2de4l3p/+v0s/4kNf35LAjTrjmc9DbFMyzBhdTS WvpWKdsxfXTSSQOY5nWsPviMDlN1DM0+TMaNtHJjndruLI9hAJTgFKR0l9S7BWAbeq7Y coeDUuuNAKlHuoh2Dacyyd0x+lwWoMb5OiOOrck/3Sx1EnEsdQ21QLZF/cb+C9LTfgMQ c1YNNeck95Tt6EIIBUjvon0cOnvXhMOmGSs1GJlBcIxj3EauFZrWP19kNaRNiwKkyjUE ebjuFMPqZCGkUjKh7AzOWH+qiyApV9KVMwxucdTnwHovckqy81ivECeW5zKjpBV23Ejv f/rA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720009697; x=1720614497; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=43sqLil+gkFHtxclLfMxbCmEVEXC+KGvLI39pYVnV5U=; b=Q1cSu1VzqfkcZz8O0sUYNdSx8Df8z9ISRCgy50402A2iPO55iUYI6PrGbTY/0Ah3nU RqcaDqM2FSF4qObYX5qnUdanDkWBMX1f11zYFXPkNry4fdDjy6X22q4AXk5bfUEiTjJI +8GRhsRB97iVnvTZGilGRNbfNuaxPUwFX1dUiclrlZEYWPMlBcURqnx0RRY/4rTrcJdQ TwwFLHG7Ub78mRElRTGQ7UajfY235BhYBfihEvmbu1z30m0nXFVNTSgmnzS4Kuu4wpSd RMNCzi/f1Hu5zUiARNhKaCjeJucawYsoDhrTOsY3efjbmuIQwk+DUN+6rU/DcZ/GZgAz WZJQ== X-Gm-Message-State: AOJu0YwEBopuCG0O32ygyoOM7geqDZ38aGx+Ppul3TsuxLWWUkkxp1CU uirBCduKuNQuiTCHxxhN3oJd/OfteH02/esvJoD4sbJM/YqCOd1pHPQSrQ== X-Google-Smtp-Source: AGHT+IGWI2GLsSfIMueiSRrxQybFcl2rs0zIFgnJM+ChyjFJ8YMhpkwihiMRfheJl3qEqzNgP1C8WQ== X-Received: by 2002:a17:907:7d89:b0:a72:5a8c:87c6 with SMTP id a640c23a62f3a-a751443c5acmr974063066b.10.1720009696366; Wed, 03 Jul 2024 05:28:16 -0700 (PDT) Received: from smtpclient.apple ([89.249.45.14]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a72ab065187sm506906866b.139.2024.07.03.05.28.15 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Jul 2024 05:28:15 -0700 (PDT) Message-ID: Content-Type: multipart/alternative; boundary="Apple-Mail=_58B1A5E5-A5FB-44A1-B462-751BFDF08D09" Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.600.62\)) Subject: Re: [PHP-DEV] [RFC] Property Hook improvements Date: Wed, 3 Jul 2024 14:28:04 +0200 In-Reply-To: <8A3C2FDA-60DF-45A1-BA9D-11B6FB6F755C@gmail.com> Cc: php internals To: Larry Garfield References: <8A3C2FDA-60DF-45A1-BA9D-11B6FB6F755C@gmail.com> X-Mailer: Apple Mail (2.3774.600.62) From: claude.pache@gmail.com (Claude Pache) --Apple-Mail=_58B1A5E5-A5FB-44A1-B462-751BFDF08D09 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > Le 3 juil. 2024 =C3=A0 11:54, Claude Pache a = =C3=A9crit : >=20 >=20 > 2. As for readonly, I think that the invariant it is supposed to = provide should be enforced as strictly as possible. It means that = `readonly` is only acceptable if there is no `get` hook. Hi, One more thing, why I think that we should be strict here. It is not = just for preventing the user to write *dumb* code, it is also for = preventing them to write *creative* code, e.g. ```php class doc { public readonly int page { get =3D> $this->page + $this->offset; } private int $offset =3D 0; public function __construct(int $page) { $this->page =3D $page; } public function foo() { // $this->offset may be adjusted here } } ``` =E2=80=94Claude --Apple-Mail=_58B1A5E5-A5FB-44A1-B462-751BFDF08D09 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

Le 3 juil. 2024 =C3=A0 11:54, Claude Pache = <claude.pache@gmail.com> a =C3=A9crit :


2. As for readonly, I think that the = invariant it is supposed to provide should be enforced as strictly as = possible. It means that `readonly` is only acceptable if there is no = `get` hook.

Hi,
=

One more thing, why I think that we should be strict = here. It is not just for preventing the user to write *dumb* code, it is = also for preventing them to write *creative* code, = e.g.

```php
class doc = {
    public readonly int page {
  =       get =3D> $this->page + = $this->offset;
    }
    = private int $offset =3D 0;
    public function = __construct(int $page) {
        = $this->page =3D $page;
    }
  =   public function foo() {
        // = $this->offset may be adjusted here
    = }
}
```

=E2=80=94Claude
=

= --Apple-Mail=_58B1A5E5-A5FB-44A1-B462-751BFDF08D09--