__set_state (Was: Re: [PHP-DEV] [RFC] __debug_info())

From: Date: Thu, 23 Jan 2014 11:30:58 +0000
Subject: __set_state (Was: Re: [PHP-DEV] [RFC] __debug_info())
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
On Thu, 23 Jan 2014, Yasuo Ohgaki wrote:

> On Thu, Jan 23, 2014 at 3:35 AM, Derick Rethans <[email protected]> wrote:
> 
> > > On Wed, Jan 22, 2014 at 6:37 AM, Lars Strojny <[email protected]> wrote:
> > >
> > > > Love it, two things: the var_dump() properties will be replaced 
> > > > (not merged) with the "real" properties in the object (I am 
> > > > asking as that would make it very very cool for stuff like 
> > > > doctrine, where lazy loaded entities are way too large to dump)? 
> > > > As for the name, I would prefer __debugInfo() as in 
> > > > __callStatic(). I know there is __set_state() but that's 
> > > > something that needs deprecation and fixing :)
> > >
> > > Could anyone add __setState() for 5.6?
> >
> > Why would you want to do that? If at all, all the *newer* methods 
> > should be __debug_info etc. __set_state was first and changing it to 
> > __setState() would mean that var_export'ed() variables in < PHP 5.6 
> > would now no longer work? Or the other way around? It's a cosmetic 
> > change that helps nobody—just like renaming other standard functions 
> > to make them more "organised".
> 
> I mean add alias for __set_state() to keep consistent names. 
> __set_state() should be there very long time or forever for 
> compatibility.

You seem to misunderstand what __set_state() is for. It is for reliably 
representing a value so that you can "include" it's contents with 
var_export(). If 5.6 would suddenly start spitting out 
Class::__setState() instead of Classs::__set_state() then older PHP 
versions can't parse/include that outputted data anymore.

> It's small cosmetic change, but it would assure PHP to be a good
> language to learn in the future. IMHO.

But it makes as much sense as adding a str_len() function as alias for 
strlen() — which really just adds more clutter.

> 
> Anyway, I would like to write RFC for aliasing. Aliases may be added
> in the future.
> 
> Regards,
> 
> --
> Yasuo Ohgaki
> [email protected]
> 

-- 
http://derickrethans.nl | http://xdebug.org
Like Xdebug? Consider a donation: http://xdebug.org/donate.php
twitter: @derickr and @xdebug
Posted with an email client that doesn't mangle email: alpine


Thread (30 messages)

« previous php.internals (#71430) next »