Re: [RFC Discussion] Typed Properties

From: Date: Wed, 16 Mar 2016 18:15:18 +0000
Subject: Re: [RFC Discussion] Typed Properties
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-91704@lists.php.net to get a copy of this message
> Am 16.03.2016 um 19:05 schrieb Johannes Schlüter <johannes@schlueters.de>: > > On Wed, 2016-03-16 at 18:50 +0100, Bob Weinand wrote: >> The patch currently prevents that. >> It prevents all creation of references to properties. > > To all properties? Thus > > class C { > private $data = []; // No type, old code > > public function sort() { > sort($this->data); > } > } > > won't work anymore? - I think that's a major break to the language. > > Workaround then would be: > > class C { > private $data = []; // No type, old code > > public function sort() { > $data = $this->data; > sort($data); > $this->data = $data; > } > } > > Or is there a simpler way? - Quite ugly and quite some migration pain. Eih, only to typed properties. Everything else would be insane ;-) Sorry for being imprecise. >> The reason is technical: >> We'd basically need typed zvals. >> Or add some sort of write callback to typed references. > > That matches my assumption. > > > Slightly un-serious: > >> If you have a clean solution to these issues, you're more than welcome to contribute >> here. > > - No typing > - No references > > :-D E_BC_BREAK :-P > johannes Bob

« previous php.internals (#91704) next »