Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:119040 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 41924 invoked from network); 27 Nov 2022 00:35:57 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 27 Nov 2022 00:35:57 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id B81EE1804F7 for ; Sat, 26 Nov 2022 16:35:53 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-vs1-f42.google.com (mail-vs1-f42.google.com [209.85.217.42]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sat, 26 Nov 2022 16:35:53 -0800 (PST) Received: by mail-vs1-f42.google.com with SMTP id d185so7470812vsd.0 for ; Sat, 26 Nov 2022 16:35:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=KmVIxrrkx92qquRJkxfh13Qqr8vWtVgbSK3h4B/gMI4=; b=ViecopiHSoo2T0aE13jwgh3MJZjvCo1Kr1BoXsAXVuasQwpze6wkbhQgaqs4AqShMC jCZU1Fuwus5SLJny0DOWsRnlIg5xhbNahoW5x36V4zLP5Rd1L2dsAVJ2HMh4U6+p+sOF jte7YgXFJIb/cuANROrR98J6PXLinBU8aKGLCOdmUH6kuHxN9lKHhjGrdXSF6ZU3b1if XOS2RAeP5b+Im2QS4nLdoIsVXG90fGrQ2CjNqxtYKueA0r3uOmgykr6G1HAveiLZHSXO hO7TyRcFV87+qMWvQ/kErL2/gnaLpmyVLgkgu+FyoVWozUQsPYiKTviONYa+zCt1XMVv qLeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=KmVIxrrkx92qquRJkxfh13Qqr8vWtVgbSK3h4B/gMI4=; b=TaTFS5qFp3wTN8XejXwA+6esV1J3nEsyivmTEZjqimp9vJUlK42P1C6b7sK9lnCFjs 0Nu1AMHHHzjbm3FKfU9XkNdHASgnCTQZZViL2EjQ5IyP1sAOn5h/O1ROmG2nSvJngifL ngEqPBuCslxJTpOBByhgaL/y2/eQQCMhuAwAovg/qN8wB4OyRt8ny3xzOHm3q0UOjLUT 5Dwo6+WGoWst5WupVTQL6jbr70vlCOYPmwxm/+nnnK4DW3DXcO0j8JXdU8IgK4fI9KEa 6/IJkL1csJxOTZUIc7BHAGdqpVfUJI4HnWjAagpB+yFjj8ENeBRgkYkCSHDpPllyvIDL wCiw== X-Gm-Message-State: ANoB5pmJWUK/jX18DsbuNB9Cnnamx3VUkrYLwfqP/sEe7YV7hEY6EVJ5 DVcVZd+GzOko2boM3/i118i/FuKLFvOuskUEB+Z05A74 X-Google-Smtp-Source: AA0mqf5gYcEoI9qNUqrWnVW0bEu4Kyh+RW+UVCZygWI3FBAkRKi6rdz5ewPCJecEXrdjYv96svYn4O64lX687xypNi0= X-Received: by 2002:a67:fdc6:0:b0:3b0:7a41:33e1 with SMTP id l6-20020a67fdc6000000b003b07a4133e1mr8548398vsq.2.1669509352491; Sat, 26 Nov 2022 16:35:52 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Sat, 26 Nov 2022 16:35:47 -0800 Message-ID: To: Deleu Cc: Marco Pivetta , =?UTF-8?B?TcOhdMOpIEtvY3Npcw==?= , PHP Internals List Content-Type: multipart/alternative; boundary="000000000000e791f605ee68ef29" Subject: Re: [PHP-DEV] [RFC] [Discussion] Readonly class amendments From: jordan.ledoux@gmail.com (Jordan LeDoux) --000000000000e791f605ee68ef29 Content-Type: text/plain; charset="UTF-8" On Sat, Nov 26, 2022 at 3:40 PM Deleu wrote: > > As I think more about this, there's nothing about the current RFC in this > code sample. What's breaking LSP here is the child class doing state > modification, not PHP. To further expand that rationale, PHP allows us to > create child classes. Whether that class will be LSP-safe or not is up to > us, not up to PHP. > > However, the point still stands. Allowing child classes to break readonly > will make it easier to build code that breaks LSP. The question then > becomes: why is this being proposed and is it worth it? > I cannot help but feel that the way `readonly` is being treated is going to end up one of those things that is regretted. "Readonly does not imply immutability". The fact that very nearly *every* single person who has not worked on the RFCs has at some point been confused by this however should be very telling. This comes from two *different* avenues that compound with each other to *both* make this design head-scratching to me. First, in virtually all other technical contexts where the term "readonly" is used, it means that the information/data cannot be altered. That is not the case with readonly. In PHP, in this implementation, it is not "readonly" in the sense that it is used everywhere else for computing, it is "assign once". Second, the English words "read only", particularly to native speakers, make this behavior very counterintuitive and confusing. I won't belabor that point further. What "read only" really is, is "constructor initialize only". It honestly has nothing to do with "read" as it's implemented. I guess I worry that this RFC makes `readonly` even more of a minefield for PHP developers, increasing the mental load of using it in code while *even further* watering down the benefits it may provide. It's already designed in a somewhat counterintuitive way that I feel will be almost completely replaced in actual code in the wild by "immutable" if PHP ever gets that. LSP doesn't exist because it is some objectively better way of programming according to universal laws of entropy or something. It is instead important because LSP helps programmers be able to predict the behavior of the program they are writing and reduces the short-term memory load involved in programming and architecture. Something that *technically* complies with LSP but makes the program harder to predict and increases the mental load of programming violates the *purpose* of LSP. We can argue about whether it is technically correct, but I feel like that somewhat misses the point: making the language more capable, more stable, and more predictable. In other words, I do not believe it is that important or care to argue about whether this RFC violates LSP. It violates the *purpose* of LSP, and that's a bigger problem to me personally. Jordan --000000000000e791f605ee68ef29--