Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:91715 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 47342 invoked from network); 16 Mar 2016 21:47:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Mar 2016 21:47:29 -0000 Authentication-Results: pb1.pair.com smtp.mail=php@fleshgrinder.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=php@fleshgrinder.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain fleshgrinder.com from 212.232.25.163 cause and error) X-PHP-List-Original-Sender: php@fleshgrinder.com X-Host-Fingerprint: 212.232.25.163 mx207.easyname.com Received: from [212.232.25.163] ([212.232.25.163:38111] helo=mx207.easyname.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 33/5F-48430-E64D9E65 for ; Wed, 16 Mar 2016 16:47:28 -0500 Received: from cable-81-173-135-2.netcologne.de ([81.173.135.2] helo=[192.168.178.20]) by mx.easyname.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1agJHn-0000Ux-7C for internals@lists.php.net; Wed, 16 Mar 2016 21:47:23 +0000 Reply-To: internals@lists.php.net References: <56E9CC3E.10205@telia.com> To: internals@lists.php.net Message-ID: <56E9D45D.4060309@fleshgrinder.com> Date: Wed, 16 Mar 2016 22:47:09 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.0 MIME-Version: 1.0 In-Reply-To: <56E9CC3E.10205@telia.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="bt4KIh1AVa7L1dwq8ttHWkcA968JDe19f" X-ACL-Warn: X-DNSBL-BARRACUDACENTRAL Subject: Re: [PHP-DEV] [RFC Discussion] Typed Properties From: php@fleshgrinder.com (Fleshgrinder) --bt4KIh1AVa7L1dwq8ttHWkcA968JDe19f Content-Type: multipart/mixed; boundary="Jef6udFmFNmHie9qBm6fGEWedmaRe9ehB" From: Fleshgrinder Reply-To: internals@lists.php.net To: internals@lists.php.net Message-ID: <56E9D45D.4060309@fleshgrinder.com> Subject: Re: [PHP-DEV] [RFC Discussion] Typed Properties References: <56E9CC3E.10205@telia.com> In-Reply-To: <56E9CC3E.10205@telia.com> --Jef6udFmFNmHie9qBm6fGEWedmaRe9ehB Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 3/16/2016 10:12 PM, Bj=C3=B6rn Larsson wrote: > Like the RFC :) >=20 > Could this be an opportunity to have default visibility for property's = when > they are typed in a similar fashion like for functions? Meaning no > visibility > implies public and code below would work. > class A { > int $i=3D7; > function f() { > echo $this->i; > } > } > $a =3D new A(); > $a->f(); > echo $a->i; >=20 > Was inspired by discussion in "var" Deprecation thread. >=20 > Regards //Bj=C3=B6rn >=20 I'd rather like to see this being package visible rather than public. Of course, that would be yet another Java thingy and I am not trying to jump on the bandwagon here. First, I like the Class Friendship RFC because it is very explicit in terms of giving access to your members. However, it fails to solve some issues in API design because friendship is not inherited and it is especially useless in a composer package world where the classes you might define as a friend are not even available (example follows). Second, I like the Private Class PR because it is very simple in hiding a class. The fact that is is purely namespace based is however a problem because one might want to have a class in a sub-namespace but still have the ability to instantiate it. Also protected classes would be only possible by restricting them from the current down to sub-namespaces which is totally meh. The introduction of a new `package` keyword to provide access modifiers for more fine grained control could solve all of the above issues. id =3D=3D=3D $other->id || $this->name =3D=3D=3D $other->name; } return false; } } id =3D count($this->entities) + 1; $new->name =3D $name; $new->created =3D $new->changed =3D new DateTimeImmutable(); foreach ($this->entities as $entity) { if ($entity->equals($new)) { throw new \Exception; } } $this->entities[] =3D $new; return clone $new; } } --=20 Richard "Fleshgrinder" Fussenegger --Jef6udFmFNmHie9qBm6fGEWedmaRe9ehB-- --bt4KIh1AVa7L1dwq8ttHWkcA968JDe19f Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJW6dRgAAoJEOKkKcqFPVVrQgEP/3GAj/pdR8zWUUhC/zCZM921 SaKazFDr5qOnUIQ2V/+iHpAK2ihNei9Hh25LGiBdMd6XXgIeniCOazODp+r6sZU+ 4uw5ZA3+HaYpu1PUXCltFQiNxbK68i2YX3IwrHE764K79KEx6n7oCZounbkqb51P RCVNEHxYJKe2vik3A8gxtcDPhE6QJh7tq9mF3NdOVlQ5IW7KwFK08oXTxCb1TWA8 oGvZuaCaRWLgLgL/BrsBPzI/E2bX8gzO9WcDlaArI1CEHgTtBJ0F4QE3YUWMIfHd d0r4VA2WHhO7WX2JBC6oVJ2Mcc3uYF5WqP4PCSf/zVtrcvc6I5yzCw5nnZKkeMLO vvQJ8UExuyF4WMQ+HGAHllzFvsgJwHDmMZaB+7+f/cA6hmo6zMa0N1Q28zZV1ppc 7EcWS5t0QSaxBFiFkOHl1y0Gfar9Wk5Q/jzF5nguLdpRRKVSElgqF89mUMAl8Tu0 BkS1JPIzLO/YHKfCbOduOKuedMllhZe39XgVfOf9+hwaHBOfBQgtdWbZra2EumKv 97nmfmNDszVHO7vXyA5YDi7no5NrxZnrAj8D3rrvFggs3Elq6vcZfcjTIkRyB6Xe 9d+r/3K6oV68L8AHoqIFIMF0Ooqw9PCRnJM5bDf4XrC0YJhheGUV4Q7v4nIhC23Y Bay12JjkUjDKfjvxqWTN =fEO7 -----END PGP SIGNATURE----- --bt4KIh1AVa7L1dwq8ttHWkcA968JDe19f--