Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123134 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 62DF21A009C for ; Sun, 14 Apr 2024 23:45:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1713138335; bh=U53YugNbZt7At3dDVKcFxW7bobGTal7tlDH/k1WswqY=; h=References:In-Reply-To:From:Date:Subject:To:From; b=bDIsS6tVj7Vl8UKXINCLXIcmNiP2/7hDcIVvU1yhGprP/5YFalroPKzU/W7qbvcfT 9qRAXhpQtrhDf4ljQE0arK3oBpYgdSJoZbdwhnXpdqiwzHJCpHobD+nE1RLvPtZY24 zvjNXAXU6kVxOozKKNZRqC8t6H6Jk5PPxsqDhGvFuWGgLaDvIK04bgzhLC49947oAI 1n0e6iq09jJy/fUhY8Xw7RjNzcTAZp/26I3VclMMXaAAuoGzs4baRJQk14Z7QhqocC FRAVoBCnHpztYTGH7boIsR5u55Vtzm21h+C5J9To3/+f3WAAak15PY7N879BU6USUm 3T4NI4ZPkOHGQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 128DF18005F for ; Sun, 14 Apr 2024 23:45:34 +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, 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-vs1-f52.google.com (mail-vs1-f52.google.com [209.85.217.52]) (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 ; Sun, 14 Apr 2024 23:45:33 +0000 (UTC) Received: by mail-vs1-f52.google.com with SMTP id ada2fe7eead31-479c96509e1so861607137.1 for ; Sun, 14 Apr 2024 16:44:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713138297; x=1713743097; darn=lists.php.net; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=U53YugNbZt7At3dDVKcFxW7bobGTal7tlDH/k1WswqY=; b=R3oCkqKv04Iisq5Kt/VZD2I2qDkqWp1OspTGSzLg+tgUD+/Op7GRdV3fWx+PrqNYDj svXwyd3HRO78CNpry39mJL+fXQuebyAnXScIzc+e+j1kOn8imsYMBTfqfq5PXPCavhWb MLV30P148uqJnj5vUAnLM3RIHU0U3WWYaSiFwD3LBoMDbV+jahF+mH0ss1/dobKagni5 wZVCtcOEuNZsTBm0+empkRDVDOHConj46xkvtB9/ys44ZjHYHK9dC1Apy9j17cnJU7ZM OfTg+lsSYp7JHsf1pwcmU8mli3GeWGDwxHbxedjKiQnTANOXmT3rkGtDqSLMkBiD8ImC ZEYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713138297; x=1713743097; h=content-transfer-encoding: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=U53YugNbZt7At3dDVKcFxW7bobGTal7tlDH/k1WswqY=; b=UGbeiY92G3wg1el25+zW0iUqrQCfy/ynU719kTi3FfNmJH/vcV1jaMBzA0/oAFY8LQ yQigznI6pQ9ISgDrM+VZ/N9jaFCK7Kn6f+b9Qs+ylItriJUYd2Q7wX5vwwVCMxVVsXGQ cELylHF2HZqF/oqq1C0Oie9Yk8UEXSK2UHffCWhNvP8Gagaoog9lV2XwaC3Pg4o5waPB q5bafPM0qMh7XFo2O7TbI2YT5JSkwHt3IaBLvgai4FtXEH8Qbzm6HUHlsFRojcpbNGgH B/0Zeo6qxNWjLhVLL74fpuZ+EkCSNkGItvgWMshjk4DNAQDwGayqX+LihSWldAjHTV2c Zh8w== X-Gm-Message-State: AOJu0YyeyAJNsDAcgsao1RANboLPQp8HmvGm1NmKKl61/ifTzM+sXOkX 7SbejbUAvFCUxzc5jYXja17n0aPUHw0c9B6+9hj5RCgIgF0sOpE4qqUamYjhTfPsa4JCERxTgrz WWMDPVNsBT9pCczSFtYeq9sqUArEbUjwy+jY= X-Google-Smtp-Source: AGHT+IHG/Dx+5tW5Yz55X1vg0JHg4//mask5Txxzf/1HgxdsaawaURgYvTnuu4TzcPwjFQiFknwmjM/EF1cmMxcfK/s= X-Received: by 2002:a05:6102:1493:b0:47b:7034:da5 with SMTP id d19-20020a056102149300b0047b70340da5mr3990717vsv.10.1713138297310; Sun, 14 Apr 2024 16:44:57 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 References: In-Reply-To: Date: Mon, 15 Apr 2024 01:44:46 +0200 Message-ID: Subject: Re: [PHP-DEV] [RFC][Vote announcement] Property hooks To: PHP internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From: tovilo.ilija@gmail.com (Ilija Tovilo) Hi Matthew We're going to skip over the reiterations of Juliettes arguments, as they have already been responded to. On Thu, Apr 11, 2024 at 12:08=E2=80=AFAM Matthew Weier O'Phinney wrote: > > On Mon, Apr 8, 2024 at 4:41=E2=80=AFPM Ilija Tovilo wrote: >> >> https://externals.io/message/122445#122667 >> > > 2. I'm not a huge fan of the short syntax, but the improvements in the mo= st recent draft are _mostly_ ones I can live with. The part that's still un= clear is when and where hooks need a `;` termination, and _why_ the `;` is = used, instead of `,`. When using `match()` expressions, you use `,` to sepa= rate the expressions, but for some reason, the proposal uses `;` ... but on= ly when using short expressions. And if you have a full-form mixed with a s= hort form, the `;` is only needed for the short-form expression. This feels= arbitrary, and it will be easy to get it wrong for people comfortable with= `match()` statements. I agree that the distinction of `,` and `;` isn't clear-cut. I would categorize hooks as declarations, because they are really just functions attached to the property. Declarations are `;`-terminated, or have a body (`{}`) (properties, (non-)abstract methods, class consts, etc). `,`, on the other hand, is used for lists of expressions and other things (array elements, match cases, function arguments). The other argument for the syntax we chose is that it's already used in C#. > (Larry tells me that it's `match()` being weird here, but considering tha= t for many developers, their only point of reference for this sort of synta= x IS `match()`, making it feel like the language is ignoring its own syntax= when creating new syntax.) Given my description from above, I don't believe this is true either. Match arms most closely relate to the array element syntax, which already uses `,`. > 3. While I'd likely prefer Marco's approach to references (just don't all= ow them), the fact that they mirror how `__get()` and `__set()` _currently_= work gives a migration path for users who are familiar with that paradigm'= s gotchas. In other words, it's consistent with the current language, and w= ill make migrating from `__set/__get` to hooks easier. It's a lot of comple= xity, but the table you created helps with that. That table MUST make it to= the docs for the feature! Precisely. Our decision to support references (as much as possible) comes from the desire to maintain compatibility (as much as possible), not only with `__get`/`__set` but also plain props. Ilija