Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123466 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 945B91A009C for ; Thu, 30 May 2024 15:07:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1717081701; bh=zTel8twWkL0t/Al3FXTfg/mT6fVXN9lRt96jZTr9h8o=; h=Date:From:To:cc:Subject:In-Reply-To:References:From; b=fQclQY7HOUVDEb4XOxnbWI19r79A4fdiBszQTQFITg0Iek/BzDj9MsajdWTaRtRzq J30MEcc+YMfKcjAG8U2MCh3THQpLmFD35xSfcif3/RGnyurvHUB4BOCgXXzInrisoj Vy404oMTWuPS1ZHxpOg60/sp+YkSq3kQ2u7i6Z5YfLImnzbwsQZ4WviBIv4h0EO1qX 3SfF1n0dMHzqoBX1irOnvqq631nJGODmlU1d65TK1bDjTH6CHp1KjELZ3l8fbDwxtT kvz3tdKPcP7lbWiM7vQBtv8HE8UXPqESjonSPj4c6aHfnre8Q7CJMh7nIXv4eXfptX FYJtaAMj7OQsQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 6A39E180076 for ; Thu, 30 May 2024 15:08:20 +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=3.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,SPF_HELO_PASS, SPF_SOFTFAIL,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 xdebug.org (xdebug.org [82.113.146.227]) (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 ; Thu, 30 May 2024 15:08:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1717081637; bh=zTel8twWkL0t/Al3FXTfg/mT6fVXN9lRt96jZTr9h8o=; h=Date:From:To:cc:Subject:In-Reply-To:References:From; b=j5T92pWQ740IUVEIbL8yCHD5BQUzZ9RcWTTNtHtTFF6Ys2igANbGpon8bE0w8mSqh k6nWtgoXpPvyL/VedTUl1cgLpbp+uEd1tW1jACliuItqw1bwTzCbwEiBO+wOyM0o+H YRY7jxTM+BtNjdBuPT67OSozVPXAxU+OPEBjnE3wgPDO4QAwBEEgXduhU8RYjAC9pk RTCpSVmAmx1LmGLNXJsLYVhcIgCmm9ESpWuixb9Tbh7aJUTDTGQCp143Lc11pVCbCr o0+ekllGZ/Z2t4XQGQQf19MOS8nmcA4y4H5MnG4sAI6HyC9jnG5cT30aR2IC3ebNDY bFL3zQfloKaKg== Received: from localhost (localhost [IPv6:::1]) by xdebug.org (Postfix) with ESMTPS id A063B10C539; Thu, 30 May 2024 16:07:17 +0100 (BST) Date: Thu, 30 May 2024 16:07:17 +0100 (BST) To: =?UTF-8?Q?Alexandru_P=C4=83tr=C4=83nescu?= cc: php internals Subject: Re: [PHP-DEV] [RFC] Asymmetric Visibility, v2 In-Reply-To: Message-ID: References: <0a6a61cd-f203-4dea-a7f8-97e6b885c52d@app.fastmail.com> Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="8323329-848929571-1717081637=:61845" From: derick@php.net (Derick Rethans) This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-848929571-1717081637=:61845 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE On Thu, 30 May 2024, Alexandru P=C4=83tr=C4=83nescu wrote: > On Wed, May 29, 2024 at 10:18=E2=80=AFPM Larry Garfield > wrote: >=20 > > As promised, Ilija and I offer this revised version of asymmetric > > visibility. > > > > https://wiki.php.net/rfc/asymmetric-visibility-v2 > > > > > Hey Larry, Ilija, >=20 > I have one concern so far, and it's related to the inheritance section. >=20 > If in a class I define the property as private, > I know that there is no way for external scope or extending classes scope > to read or write to the property. > (of course, ignoring reading/writing using reflection or re-binded closur= es) >=20 > If an extending class defines the property with a wider visibility, > protected or public, it will shadow the initial one and not change its > visibility. private and protected differ here already, even without async=20 visibility: https://3v4l.org/8Ynog A protected property does not create a new bag to store data in, which=20 does happen for a private property. > Now, if I define the property as public private(set) with similar=20 > intentions, to make sure that there is no way for external scope or=20 > extending classes scope to write to the property, while allowing=20 > reading from external scope (or extending classes scope). >=20 > But the problem is that an extending class can define the property as=20 > public protected(set), and that will easily allow the property that I=20 > wanted to make sure it is private for writing to be changed by an=20 > extending class to be protected. public private(set) properties aren't really private, so you don't get=20 the shadowing, but you do have a point wrt to the expectation that an=20 inherited class can't easily override the private(set) part (with=20 protected(set) or public(set)). Hopefully Ilija or Larry can explain :-) cheers, Derick --8323329-848929571-1717081637=:61845--