FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Operator precedence
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Object constructors/destructors [message #185142 is a reply to message #185140] Sat, 01 March 2014 19:22 Go to previous messageGo to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma:
Senior Member
On 3/1/2014 12:56 PM, Richard Damon wrote:
> On 2/27/14, 8:25 AM, Jerry Stuckle wrote:
>> On 2/26/2014 11:49 PM, Richard Damon wrote:
>>> On 2/26/14, 8:44 AM, Jerry Stuckle wrote:
>>>> On 2/26/2014 7:50 AM, Richard Damon wrote:
>>>> >
>>>> > An the "name" of the Deserializing constructor in PHP is __wakeup().
>>>> >
>>>> > You also do NOT get two destructor calls on the same object, the
>>>> > deserializing created a new object.
>>>> >
>>>>
>>>> __wakeup() is not a constructor - and does not do the same thing.
>>>>
>>>
>>> What makes it NOT a constructor? IT seems to be exactly the thing that
>>> does what you say must be done to make the new object via
>>> unserialization.
>>>
>>
>> If you want to consider __wakeup() to be a constructor, then you must
>> consider __sleep() to be a destructor. In that case, PHP is also wrong
>> because if an object is serialized, it will call both __sleep() and the
>> destructor. This would be two calls to destructors for the same object.
>>
>
> WHY does __sleep() need to be a destructor?
>
> __sleep() is a function to control how an object is serialized, and the
> object, as you seem to know, still exists, so no destructor should
> happen at this point, in fact, if you look at it, __sleep() has not
> expected to have any effect on the current object, its purpose is to
> make sure that __wakeup() will get all the data it needs, and allow the
> removal of data that it won't need.
>

If you are going to claim __wakeup() is a constructor, then you have to
agree that it's opposite (__sleep()) is a destructor. Otherwise you are
being inconsistent.

You can't just make up rules as you see fit!

--
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex(at)attglobal(dot)net
==================
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Correlating curl resources to some other object.
Next Topic: Experienced Web designer required
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 24 00:39:17 GMT 2024

Total time taken to generate the page: 0.05310 seconds