Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123528 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 097151A009C for ; Wed, 5 Jun 2024 21:40:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1717623673; bh=h3aecl4pWjFPVDgiD84v1OkvsXWBGJOXBR96DkUM8GY=; h=References:In-Reply-To:From:Date:Subject:To:From; b=LLxq/hBvxTj1ciAp9tuJ4OAWidiAE7lDfu6oniYVJvyfypbkfgXDFv2Zdx5/zCbpw INIxi4NRlMhBkUYwln7W1lidljCdmQbndO6Dl7yzIhkve+FoKu3d6A/b/yjswukl0+ jaFhgNJw39uFURgo6y9HBlhlj/WLQKgTHhMhb71G4Rp9RZBE2aPxVN+8f/O/PvBZhy xZWAbreaakLQCKInutofL9smkJO/V4cTfgOPGdm7O4U7fKlfo4WOOMb+HvEfp82wYT IYUw0l5MMy5UkFnYhUPtSWtkpg2P+MibHEEkBxG/MPJpTJScWIdxCzjw39iP1H7ouK i21ibJ3d5g3zw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id AF39D18007A for ; Wed, 5 Jun 2024 21:41:10 +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_H3,RCVD_IN_MSPIKE_WL,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-qt1-f169.google.com (mail-qt1-f169.google.com [209.85.160.169]) (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, 5 Jun 2024 21:41:10 +0000 (UTC) Received: by mail-qt1-f169.google.com with SMTP id d75a77b69052e-44027277ebdso1186851cf.1 for ; Wed, 05 Jun 2024 14:40:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717623604; x=1718228404; 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=h3aecl4pWjFPVDgiD84v1OkvsXWBGJOXBR96DkUM8GY=; b=nhkHNG4BijfTtFkTWe6H5gghoQG/QwNO1jnYzLlTn6O5WM2XkK6LML+bK2eHB68kud DOX0/HryKTE7/VFYlmltKPxnJEk6r5Gxmwxh7UOd7AfI9tB8QIKpblpy0vuAShMls44z /12fNY8Mnca0CB+cIUXq4CsACotnWwyzadbUVA2X1Mz5WSvDik6kVVnrfwWyPqJVAUK2 ubDh/KFwrXWBzoRbDwEwxw6M2mycXrluOFCZvr3IXUWrlnWvhizxB3TpMpQmDvJ6wii7 BrXkFkmFfdMXOLVqbkrQew7yV1oVg04JzhDWcTThpi1hzgu8Ldodfum0wXzzuAdjAcG4 RF9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717623604; x=1718228404; 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=h3aecl4pWjFPVDgiD84v1OkvsXWBGJOXBR96DkUM8GY=; b=EUtsth3mSX2Kv19AOrSqI/aRYfdZ3hRexLkEjsn8UYzklLL4X7RVYnDMg9M7tQKFkQ wue7oPGo1vveyEPxVjJNzGaqs1AkK/hO5LhkWGpC7u9NAHpcN5/9vcAnl8EG4UuxE2Fd aPV2gMTd5eLsyx4n9zqZqNEGvh3gpvtdcJkeQ2jYuR1NJG0tYBKo8Ogeb84GiMlozuSL VrwonioEkr0FEDTTVn0eqT0y68SwQGa3GZTEs7+py1ZOvG3jfEaTDbucxpOIWYQCGdMb 4Z9AvbF/BYVXM8nWNAy4n3GkEJa2hgeoYW1RL2i2zoscxU94aujCWyfwfLYOd1P1wg+l tPrg== X-Gm-Message-State: AOJu0YzxWH+q/6tzMgjp9RPrGWSXccG5cm9ywZ1dMCYYm0XpzctZjQ5j H7KF3Hxo8fmS7W4V8WgUnGfMfOTW5kXIEQrel2vLcglz6VJEcj/sr5r7HykPQLJrGS7HNw3D/ku NVZiBPJie1nDdNbKsGSSLCS+1jkCu+Mzfi+azcA== X-Google-Smtp-Source: AGHT+IFlJ5pOzMXs4ZSLtGQJHIOgaGRr1M9+WRMln7BLeWtg9LJI/3WwwWypM2aiUtqdFZDoUHHQKb5e/WNt1PPu4vI= X-Received: by 2002:a05:6214:3a89:b0:6ae:3d14:895 with SMTP id 6a1803df08f44-6b02bf0ec01mr43430966d6.1.1717623604254; Wed, 05 Jun 2024 14:40:04 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 References: <0a6a61cd-f203-4dea-a7f8-97e6b885c52d@app.fastmail.com> <6b798516-8854-4479-806f-dc2877c6b0ea@bastelstu.be> In-Reply-To: <6b798516-8854-4479-806f-dc2877c6b0ea@bastelstu.be> Date: Wed, 5 Jun 2024 23:39:53 +0200 Message-ID: Subject: Re: [PHP-DEV] [RFC] Asymmetric Visibility, v2 To: php internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From: tovilo.ilija@gmail.com (Ilija Tovilo) Hi Tim On Tue, Jun 4, 2024 at 7:54=E2=80=AFPM Tim D=C3=BCsterhus wrote: > > One thing that would get pretty wonky would be private-read properties: > Private property names are currently internally "mangled" to include the > class name. This allows to define the same private property in multiple > classes of an inheritance chain, without those classes needing to know > about the private properties of each other and making the addition and > removal of a private property not a BC break. For all intents and > purposes those private properties to not exist, unless you are the class > itself. > > I have no idea what the semantics of a public-write, private-read > property should be - and this problem is pretty similar to the > sibling-discussion about making private-set properties implicitly final, > because otherwise the semantics get wonky. > > I believe that the case of making a property public-write, private-read > is best left to a virtual set-only hook. Indeed. A private property with a more permissible set operation is the wrong approach. What we'd want here is a public property with a restricted get operation. This is not quite expressible with the current syntax. We'd need something like `public private(get)`, or `public $prop { private get; }` with the C# equivalent. However, this is quite an edge case, and since it requires additional syntax I don't think it's something we should support without a specific use-case. You can emulate it with a set-only virtual property, if you really want to. Ilija