Re: [RFC] Propety Accessors v1.1

From: Date: Wed, 10 Oct 2012 09:25:24 +0000
Subject: Re: [RFC] Propety Accessors v1.1
References: 1 2 3 4 5 6 7 8 9 10  Groups: php.internals 
Request: Send a blank email to internals+get-63314@lists.php.net to get a copy of this message
On 10 October 2012 01:16, Johannes Schlüter <johannes@schlueters.de> wrote: > Up until now reflection is leaky and is telling the truth. We should > either keep that or completely clean up reflection. Reflection should always tell the truth, or there is no point in it. On 10 October 2012 04:28, David Muir <davidkmuir@gmail.com> wrote: > That said, it wouldn't help for scalar values, and that leads to a problem > with the current syntax (AFAICS). You can't specify the initial value for a > property: This is one of the points I was trying to get across, there is currently no way to set the default value*. If your setter performs some sort of calculation on the value, then you're going to have to reverse that process in order to set the initial value constructor. *Unless you use the following highly confusing approach. class MyClass { protected $__property = 'default'; public $property { get; } }

« previous php.internals (#63314) next »