Re: Abstract properties
| From: | Marcello Duarte | Date: | Mon, 18 Mar 2013 10:17:06 +0000 |
| Subject: | Re: Abstract properties | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-66682@lists.php.net to get a copy of this message | ||
On 1 Dec 2012, at 12:34, Sebastian Krebs wrote:
> Hi,
>
> Don't want to start a big discussion, but is there a concrete reason, why
> abstract properties (or "a kind of abstract") are not supported?
Hi,
The reason for not having abstract properties is that when you are defining a type you don't
care about how the implementation will store the state. The contract is about message exchanges, how
the objects will talk to each other, via the public interface, e.g. the public methods.
Also, think of the keyword "abstract" as something that is incomplete. An abstract class
is an incomplete class, an abstract method is an incomplete method. So an abstract property
doesn't make sense, as it doesn't need anything to be complete.
Reinforce the implementation to store state in a particular way would be a bad feature for PHP. This
is one the things we got it right.
Kind regards,
Marcello