Re: [RFC] __debug_info()

From: Date: Wed, 22 Jan 2014 11:12:41 +0000
Subject: Re: [RFC] __debug_info()
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
On Tue, Jan 21, 2014 at 9:46 PM, Pierre Joye <[email protected]> wrote:
> One additional comment, I am not sure about the manual merge of
> properties. Maybe it should create an additional property called
> "debugInfo" or something similar and store the result of __debugInfo
> in it? It could be more user-friendly and less confusing.
>
Functionally speaking, the merge has to happen regardless since we
can't just put temporary elements into the properties table and return
that.  Sure we could do the work for the user by putting the merge in
the standard object handler, but what does it buy us?

From my point of view, it buys us less options for the user.  By
returning the result of __debugInfo() as-is, the class author can
replace, merge, or stuff debug into an extra prop at their discretion.
 By making a unilateral decision to merge, we exclude the option of
not including certain props.  By making the decision to put
__debugInfo() result into a specific '__debug' prop, we take all the
options away.

Personally, I'm for giving power to the user here.  (Not least because
my use-case would quite like being able to control what's shown for
var_dump())

-Sara


Thread (30 messages)

« previous php.internals (#71405) next »