Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:93862 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 48091 invoked from network); 10 Jun 2016 13:01:21 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Jun 2016 13:01:21 -0000 Authentication-Results: pb1.pair.com header.from=ocramius@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ocramius@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.46 as permitted sender) X-PHP-List-Original-Sender: ocramius@gmail.com X-Host-Fingerprint: 74.125.82.46 mail-wm0-f46.google.com Received: from [74.125.82.46] ([74.125.82.46:33546] helo=mail-wm0-f46.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BA/D8-00193-F1ABA575 for ; Fri, 10 Jun 2016 09:01:19 -0400 Received: by mail-wm0-f46.google.com with SMTP id r190so2919045wmr.0 for ; Fri, 10 Jun 2016 06:01:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=ZMm1qMYM+8tW0QS+NKxCBOCXQgElu1BcjT0e7+QCkgw=; b=TFhqGafNwb8M0DGK30GD2T3LG8fSbb1ufzkAC6wjJTzKS0myYeyxgB369Qwz1rRPqQ fgxnkdh+mUiBnB328zwt5S+VQtBvsxkQbIGfzkUb5KXhDAGgewrP+eo9CR+iPYt38fCn EbtWxPeJLbBEPtH+TEpysFXFPQbPRttzBRGKXOyzO3TCzS6fGVUedvBJakNrmzjKn3Q4 h5wc6eZLW3+qxKbt/lUTm2Ddim30UFaB6dEjF7DJrsuA6G2liEBCBy0Vq/tT/Y+EGxRN 0KHE9VaC4qI3sdutING2SvFnzWkZ8CYGpYNAnxn042eKhnuzfBzRA3bSFXP9lHsj0YW8 s0XA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=ZMm1qMYM+8tW0QS+NKxCBOCXQgElu1BcjT0e7+QCkgw=; b=HGmpErH0g0fdHEW/0JncHebId4dZ+mOT9vf6k6eyI8HkEVu3xJKSwTnKM3GSXxWkBC ZuTLrwO27O358Uh16EjJqqNDdLl6+v2MDCv8KLzsWjRHkawSlD6c0UaqXV6CB+4y4Y1L qU8gpHNZbmZsrfhKeMa4BEXO7e9BLbZIaFGGomI13HgqyM2tghet3u3756YCr1TG2uR8 4WfFqk/RDuuyLdmh4dIiwgbhK+Wneqen32gaPFL9bJH/VTGyJlxmdkCwsdR0kUtGeYbu r8ts8xJJ8thVYUygKeTKlnZvSUVF3350tUk4YxQ/zZCeEz9WiKmxIaC4nOQSqtHyqlNN FovA== X-Gm-Message-State: ALyK8tI2y5Cq7fJ3cRpKa3elnedif6z52Q2YDg9Xk5Rm+h6Dw1dFClNqtZNtw5t6g729ifaMVhPlkA3oeLXKIQ== MIME-Version: 1.0 X-Received: by 10.28.38.198 with SMTP id m189mr2766886wmm.34.1465563676385; Fri, 10 Jun 2016 06:01:16 -0700 (PDT) Received: by 10.194.163.106 with HTTP; Fri, 10 Jun 2016 06:01:15 -0700 (PDT) Received: by 10.194.163.106 with HTTP; Fri, 10 Jun 2016 06:01:15 -0700 (PDT) In-Reply-To: References: Date: Fri, 10 Jun 2016 15:01:15 +0200 Message-ID: To: Niklas Keller Cc: Joe Watkins , Philip Sturgeon , PHP internals Content-Type: multipart/alternative; boundary=94eb2c040c2c53a89f0534ec22d9 Subject: Re: [PHP-DEV] [RFC][Vote] Typed Properties From: ocramius@gmail.com (Marco Pivetta) --94eb2c040c2c53a89f0534ec22d9 Content-Type: text/plain; charset=UTF-8 Top-posting, since I'm taking off now. From outside the class, properties are not visible at all, so their types are un-important from outer scopes. echo $foo->bar; is not the same in instance method body or outside of the class. On Jun 10, 2016 2:55 PM, "Niklas Keller" wrote: > 2016-06-10 14:39 GMT+02:00 Marco Pivetta : > >> As already mentioned on twitter, I voted "no" on this RFC as it currently >> stands. I might reconsider if following points are addressed: >> >> 1. __get semantics are not changed: let __get behave like it usually >> does, >> and let the user define a type hint on __get, should any be applicable. >> Basically: >> >> class Foo >> { >> private int $bar = 123; >> public function __get($name) { return 'banana'; } // *ALWAYS* works - >> why would I even want a type error here? >> } >> > > You want a type error if bar is unset, mainly because Foo->bar should > always be an int. > If you unset it and set it again, it still has to be an int. And > reflection will tell you it's always an int. > So why should __get be allowed to return something different? > > >> * by-ref access should be enabled when the reference property has the >> same >> declared type as the source one >> >> class Foo >> { >> public int $bar = 123; >> } >> >> class Bar >> { >> public int $baz = 456; >> public string $taz = 'taz'; >> } >> >> $foo = new Foo; >> $bar = new Bar; >> >> $bar->baz = & $foo->bar; // works >> $bar->taz = & $foo->bar; // crashes >> >> Cheers, >> >> >> Marco Pivetta >> >> http://twitter.com/Ocramius >> >> http://ocramius.github.com/ >> >> On 10 June 2016 at 12:38, Joe Watkins wrote: >> >> > Afternoon internals, >> > >> > The vote for typed properties has been restarted. >> > >> > Please take part: https://wiki.php.net/rfc/typed-properties >> > >> > Cheers >> > Joe >> > >> > > --94eb2c040c2c53a89f0534ec22d9--