RE: [PHP-DEV] RFC: Property get/set syntax

From: Date: Mon, 09 Jul 2012 02:46:40 +0000
Subject: RE: [PHP-DEV] RFC: Property get/set syntax
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
I've just recently had my second child and closed on a new house, so been a bit busy. 
I'll be working to finish up what's left in the coming weeks.

Right now I'm told there are some conflicts with a merge from master that I have to resolve,
then the fork will be ready for playing around with.  Hopefully I'll have that fixed up later
this week.

From: Benjamin Eberlei [mailto:[email protected]]
Sent: Thursday, June 28, 2012 4:55 AM
To: Clint Priest
Cc: Stas Malyshev; [email protected]
Subject: Re: [PHP-DEV] RFC: Property get/set syntax

What is the state here with regard to merge into php-src?
On Sun, Apr 22, 2012 at 5:48 AM, Clint M Priest <[email protected]<mailto:[email protected]>> wrote:


> -----Original Message-----
> From: Stas Malyshev [mailto:[email protected]<mailto:[email protected]>]
> Sent: Saturday, April 21, 2012 10:33 PM
> To: Clint M Priest
> Cc: [email protected]<mailto:[email protected]>
> Subject: Re: [PHP-DEV] RFC: Property get/set syntax
>
> Hi!
>
> > empty() - Returns true for a property retrieved via __get() or via a
> > getter -- Any idea why this would be the case for __get()?  Is this a
> > bug?
>
> isset() calls __isset(), empty() calls __isset() and __get(). I'm not sure what exactly
> you consider to be a bug.
I see, well the only way to resolve this would be to add isset and unset property functions as well.

Anyone against it?

>
> > unset() - Would unset a temporary variable (the one returned by the
> > getter) -- see previous email re: adding unset/isset property
> > functions.
>
> unset() calls __unset().
>
> > sort() - Does the same thing as with __get()/__set() which is to say,
> > the array is sorted but the property is not updated with the value.
> > Should accessor behave differently than the magic methods?  Should
> > this just be documents or should this be fixed?
>
> sort() works just fine if you define __get to return by-ref.
Returning by reference was not documented in the original RFC, would this syntax work for everyone?

public $Hours {
       &get { return $this->a; }
}

>
> --
> Stanislav Malyshev, Software Architect
> SugarCRM: http://www.sugarcrm.com/
> (408)454-6900 ext. 227<tel:%28408%29454-6900%20ext.%20227>

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Thread (12 messages)

« previous php.internals (#61114) next »