Re: [RFC Discussion] Typed Properties
| From: | Johannes Schlüter | Date: | Wed, 16 Mar 2016 18:05:31 +0000 |
| Subject: | Re: [RFC Discussion] Typed Properties | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-91703@lists.php.net to get a copy of this message | ||
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.
> 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
johannes
Attachment: [application/pgp-signature] This is a digitally signed message part signature.asc
Attachment: [application/pgp-signature] This is a digitally signed message part signature.asc