Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:116476 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 4076 invoked from network); 22 Nov 2021 16:51:11 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 22 Nov 2021 16:51:11 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 3D197180510 for ; Mon, 22 Nov 2021 09:47:41 -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 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-ua1-f52.google.com (mail-ua1-f52.google.com [209.85.222.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 22 Nov 2021 09:47:40 -0800 (PST) Received: by mail-ua1-f52.google.com with SMTP id y5so38222530ual.7 for ; Mon, 22 Nov 2021 09:47:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=KhLnwYH592W8dmFcG1OgPjNZRdMR5rOUD9kR0Hr+itM=; b=j+KiF0UOb7po03obGS2egpQY/nTZoScM5qT1YVwX3UIdYRyWXZmoHekiSNhBGfutJb IlqwG+2Ar0RlaGx3r7GZArydeH1hq3HnrfS/1i2RmpOw0AjNhcmJ/pbDOgYC1kVg7Jah ib2c/UPanufmikJWftkhr84Z8YiaMhBTx9OCtMX2qKryzq71WG2KZtOfEnlgpQnBTvOm HhzNzbVba+d+bp2R0y2XsSSv1IcSmyQd5gKwA/V/yYaXTfet4JyMCI9AT+xzNlD0ctT3 1u2mwWeK7G3ulOnGTKo8zXi9v9Ft2C3kcehysG7huPG8SRu6JT/2nl7X9Tc0zL7Opxzg d9hA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=KhLnwYH592W8dmFcG1OgPjNZRdMR5rOUD9kR0Hr+itM=; b=Twgjcq8nyniR7SOsd+BamzeunCKCg50g4wk34xgy38f9dDSc+rDS9CvU7aAhH0h2LI WJNNQZveuqQEkbL9OnYhQkszm4Z30uxiWzDnhAmZm32x1yA5BBBew8sWx1eyvpocGMaK Zsdurt0CCpy8prnxEN/ewkDsVlNXthbr9ji/+u1uHKwy3Gz4KBnT/nOw8jaFJ75DLJzI BTeM+YVrS6c3+rL811WzI8HxGI3VKE58SobFQ24Vz9mytPu31fwbY2eKuy16wjpOmdd7 ElS+OeizOHavWdvqf8ACFtW/YBW3XmeJmcC5jyLYE80Ob02XJi/LSwV7ddqzmBlOJuie xKkw== X-Gm-Message-State: AOAM533qyvs0zkwlRCxdzmjx7va4k5TAqncRt8i7sPVovNWxk/VgwYzJ RYDeEObMcrANrd8eI6D6ZTwRkSqZe/4TffAitnIYDG4gVoYSOA== X-Google-Smtp-Source: ABdhPJz821+F+X/01I6gyQWQl/K6Et0TBlGtIXy9WQZpjJCkUTXUf8R5zGfZfBsbVhYlkf2ox7Rrxx9jtzVvUsFSo/M= X-Received: by 2002:a67:e3ca:: with SMTP id k10mr104134753vsm.45.1637603260037; Mon, 22 Nov 2021 09:47:40 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Mon, 22 Nov 2021 18:47:29 +0100 Message-ID: To: =?UTF-8?B?TcOhdMOpIEtvY3Npcw==?= Cc: PHP Internals List Content-Type: multipart/alternative; boundary="00000000000098fce305d16438ec" Subject: Re: [PHP-DEV] [RFC] [Discussion] Readonly Classes From: michal.brzuchalski@gmail.com (=?UTF-8?Q?Micha=C5=82_Marcin_Brzuchalski?=) --00000000000098fce305d16438ec Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hello M=C3=A1t=C3=A9, pon., 22 lis 2021 o 17:14 M=C3=A1t=C3=A9 Kocsis na= pisa=C5=82(a): > Hi Internals, > > I'd like to propose adding support for readonly classes: > https://wiki.php.net/rfc/readonly_classes > > The implementation heavily builds on the semantics of the already accepte= d > readonly properties RFC (https://wiki.php.net/rfc/readonly_properties_v2)= , > basically the only thing I had to implement in the PR are the following: > - Any declared property of a readonly class is implicitly treated as > readonly > - Creation of dynamic properties is forbidden > Personally, I'm not convinced at all about this idea. The read-only property for me is a preliminary step before introducing full-blown property/field accessors. Instead of making the whole class readable I'd rather see sort of data classes similar to record classes in other languages where you get pass-by-value, built-in object initializer and class composition over inheritance like Go structs. But regardless of what I'd love to see this feature, I see no justified use case. Therefore I ask if there are any real use cases of it? and if there are other languages with similar functionality? Cheers, Micha=C5=82 Marcin Brzuchalski --00000000000098fce305d16438ec--