Re: Property Accessors v1.2
| From: | Benjamin Eberlei | Date: | Sat, 13 Oct 2012 08:06:29 +0000 |
| Subject: | Re: Property Accessors v1.2 | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-63386@lists.php.net to get a copy of this message | ||
On Fri, Oct 12, 2012 at 7:23 AM, Clint Priest <cpriest@zerocue.com> wrote:
> Alright, here is the updated RFC as per discussions for the last few days:
>
> https://wiki.php.net/rfc/propertygetsetsyntax-as-implemented
>
> If you could read it over, make sure I have all of your concerns correctly
> addressed and we can leave this open for the two week waiting period while
> I make the final code changes.
>
> -Clint
>
>
Can we discuss the removal of automatic get; set; again? For me that was
the best feature of the whole RFC, essentially allowing to define a
property with getter/setter in 1 LOC. Allowing future overriding of that
getter/Setter if the application required it.
This is absolutely essential for database backed recods which will have
tons of those property accessors. Now if i apply PSR coding styles to
accessors, then i end up with 11 LOC for accessors defining a property, a
property accessor and get/set functions, compared to 10 LOC with usual
getter/setters.
As i understand it was removed because of the unclear behavior when we have
the following code:
public $Foo { get(); set($value) { $this->??? = $value; }}
I propose to reintroduce this shortcut, if you define both getter/setter as
automatic:
public $Foo { get(); set(); }
The syntax is up for grabs, but it would be very sad if this be removed.
greetings,
Benjamin