Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128130 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 lists.php.net (Postfix) with ESMTPS id B35C71A00BC for ; Sat, 19 Jul 2025 01:04:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1752886956; bh=ttOIOmbQEphZteF1AzP3cCWUAiSnaoM3wLxZfLED5kA=; h=Subject:From:In-Reply-To:Cc:Date:References:To:From; b=PqJoQLNkuq2yuaXQ3CSreJtMmDQXI4QDKVTn6vaulTbDRUlOdgCTnlgoVg4W/xomE a7EfgsX2wVoQAs1HUZYp8ijzM3yxVhy0zrdrB6yrQGh5qPXIBz6wH+baz2GrmN5h71 zBqKLaqJQ1m+/ls3NZEfSJzCTmX1/7eIM8DkFbFlC3qIoKGma8hJyBydmXw4wQ7+fm qidPT2iOVa+hJ1Pmsq9osSjufwGQiD+LK74Rs0SDz8ElArNhSSMzukehpveDCKMHAj 0Milqe/34wAi8ECiClpp5ODbiYdy7M/yUgxfk/KRPwSJep4TJgJIdTEoaE2ELBDZTU na7WEnPxaDb+w== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 1AB5618006A for ; Sat, 19 Jul 2025 01:02:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.4 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, HTML_MESSAGE,MIME_QP_LONG_LINE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) (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 ; Sat, 19 Jul 2025 01:02:35 +0000 (UTC) Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-4561607166aso20540525e9.2 for ; Fri, 18 Jul 2025 18:04:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1752887061; x=1753491861; darn=lists.php.net; h=to:references:message-id:date:cc:in-reply-to:from:subject :mime-version:content-transfer-encoding:from:to:cc:subject:date :message-id:reply-to; bh=RnaA7QpAuW1Tme3NNr9Yj3IzBM3eR+FnlIKmCRSHeRQ=; b=XmDMRerFFoig24Iybdgte2YmbnquOlym2cSE/TS9X5VrYlsDdIQfYcRWiGx3BXY+t7 XMbTL3bKy/64gzl5yqlI7/KHRsNNWan4RBR2eMRvXBcmhzBlNictpwy7LRHjDpbDYzUk ESaonohJ1Mb1vlJaxRnAOlqfH7SU6uIbOAuKEXfdq2Wfr/HBwvqlbaX4svshI7mlfWLZ hq86f4XIXVe9l7lyhKVV60x1E7zpWViI+mKd/dyMWibbQB5Db4+evpAHnPn84rHwC1tf GKjT+K8mbmT/0Bfgak/hy3yd1g/GTdLHCZsMhnPS+IHQ2iHkYpbTZAbK691AQ8iqXUgh UGjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752887061; x=1753491861; h=to:references:message-id:date:cc:in-reply-to:from:subject :mime-version:content-transfer-encoding:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=RnaA7QpAuW1Tme3NNr9Yj3IzBM3eR+FnlIKmCRSHeRQ=; b=wYWlpmLrH13tArffed7ECzFdqDuXu3Iu+no7ZDU0M0vFVEMpFr5rQvNEL+121QaVzE g/ZaJ+eTfTYWTNq9uCEiVFV1CojkJfRKQ1boXVyAOefua6CSJgI7+eN/5BQVHdj2Ss1o wPnW9PezadnHaG0tFWupTiAQQRRoRyyQg/YIum3qifoDjhu45b0iucpzY8/PskJQMQ26 wPnMtwKIIfjCg0lAgflNUcKUoTPrFUS9jFnNwtf/gcm1btzmOJyZ7LcoTj+KrfHO5NU4 OpC5ANdPmyOcb+Ity8jlisFyT+gWo5um36yreSlErABJDJz8jdBzc8gLVeqrgeRLNsHy Clvw== X-Forwarded-Encrypted: i=1; AJvYcCVkRi+p6bW1f6IKkNxlfrmv+VHXhC3yDKgrouEYN0EvGBMtqqzN1AbYMnhNFOOn62vcfXn+b11OlEY=@lists.php.net X-Gm-Message-State: AOJu0YwzX6d7Lc9+13SdzQBMSNb07PRgvd4Tc0CF5D+mJs35AdWAsn24 5qat/yLJ/JBTGsR07VOfhvG9aOxFZ4Yh9cHGMe2z/yxa8ZW7cl/FkS3J X-Gm-Gg: ASbGncu2Cc7BuWJdmq8dY8vycI7wyUrOUQjLhtoOfGpAylbfH0R5X9wDPRekn/h6Qzh 0Fv4x9QXq//JexdeF4h7T7UXePrHTao34dvPceJpiderzCxgKW9cf4t/XoeCT+VvuGvcZaxhi+R LQ2LBCmD9XJl6V+huO2qDtsUKq7lJwR5Sc5jH5jK6B012o3SvJzDLat4XIboEawnqRxUqRS0/4H j2TJiusiK6mzHY1vZbCMpla8Ix8CKuWIemVtS7P5yaCFg5Hg1Mr9AO8MW/OjQw5O90p0dHFZiSh H4WW2GiHTGmqEs9E4lz1Bd4C1G3VAk8OWeL/i3LEBmt46fUOc3EmejJZpCVzNdYRMX4xQfwgNMH ckV23FaqigCsTGs3FuUWS4ocGINuJ0dSs/OJeMmKx994= X-Google-Smtp-Source: AGHT+IGRykIRMf6Y+xxJRgToT3nJgKjLIp2Xlr4xwuO3dt73wLTt2kdOwJWScQ/NC++us1mta2L9vA== X-Received: by 2002:a05:600c:c08b:b0:456:24aa:958e with SMTP id 5b1f17b1804b1-4562e3d4f52mr107277685e9.0.1752887060773; Fri, 18 Jul 2025 18:04:20 -0700 (PDT) Received: from smtpclient.apple ([178.197.218.13]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3b61d7fe48fsm2633716f8f.14.2025.07.18.18.04.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 18 Jul 2025 18:04:19 -0700 (PDT) Content-Type: multipart/alternative; boundary=Apple-Mail-FF1AA0CA-4419-4D7C-BDDA-0C0CB33137FA Content-Transfer-Encoding: 7bit Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow Mime-Version: 1.0 (1.0) Subject: Re: [PHP-DEV] Re: [RFC] Readonly property hooks In-Reply-To: <378cd8b0-c4a8-4e53-b0bd-e9e4f30a454d@app.fastmail.com> Cc: erictnorris@gmail.com, Nicolas Grekas , Larry Garfield , =?utf-8?Q?Tim_D=C3=BCsterhus?= , php internals Date: Sat, 19 Jul 2025 03:04:08 +0200 Message-ID: <77128196-8D53-40D6-9BB7-77160AD71ED9@gmail.com> References: <378cd8b0-c4a8-4e53-b0bd-e9e4f30a454d@app.fastmail.com> To: Rob Landers X-Mailer: iPhone Mail (22F76) From: claude.pache@gmail.com (Claude Pache) --Apple-Mail-FF1AA0CA-4419-4D7C-BDDA-0C0CB33137FA Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable > Le 19 juil. 2025 =C3=A0 00:41, Rob Landers a =C3=A9cri= t : >=20 > The original author (Nikita) suggested that there's nothing in the origina= l design that precludes accessors -- and highlights languages where there ar= e both and they are doing just fine more than 5 years later. Hi Rob, It is indeed entirely reasonable to have both readonly properties and hooked= properties (aka accessors), and today PHP has indeed both of them (and even= asymmetric visibility on top of that, as a separate feature contrarily to C= #). But it doesn=E2=80=99t mean that it is reasonable for the *same* propert= y to be *both* readonly and hooked, which is the point that is currently dis= puted. =E2=80=94 What do the other languages allow? Is it possible to define= a readonly property with a user-defined getter? (Disclaimer: Even if one of= them allows such a thing, I=E2=80=99ll still think that it is a bad idea.) =E2=80=94Claude=20= --Apple-Mail-FF1AA0CA-4419-4D7C-BDDA-0C0CB33137FA Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable


Le 19 ju= il. 2025 =C3=A0 00:41, Rob Landers <rob@bottled.codes> a =C3=A9crit&nb= sp;:


The original author (Nikita) sugge= sted that there's nothing in the original design that precludes accessors --= and highlights languages where there are both and they are doing just fine m= ore than 5 years later.

Hi Rob,

I= t is indeed entirely reasonable to have both readonly properties and hooked p= roperties (aka accessors), and today PHP has indeed both of them (and even a= symmetric visibility on top of that, as a separate feature contrarily to C#)= . But it doesn=E2=80=99t mean that it is reasonable for the *same* property t= o be *both* readonly and hooked, which is the point that is currently disput= ed. =E2=80=94 What do the other languages allow? Is it possible to define a r= eadonly property with a user-defined getter? (Disclaimer: Even if one of the= m allows such a thing, I=E2=80=99ll still think that it is a bad idea.)

=E2=80=94Claude 
= --Apple-Mail-FF1AA0CA-4419-4D7C-BDDA-0C0CB33137FA--