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

Home » Imported messages » comp.lang.php » out of sheer curiosity...
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: out of sheer curiosity... [message #177579 is a reply to message #177571] Tue, 10 April 2012 12:11 Go to previous messageGo to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma:
Senior Member
On 4/10/2012 6:43 AM, Thomas Mlynarczyk wrote:
> Jerry Stuckle schrieb:
>
>> Objects NEVER persist between different HTTP requests. By definition,
>> HTTP is a transactional environment and at the end of the request any
>> objects are destroyed.
>
> True. But since we do need objects to persist, we invent things like
> sessions and serialization so our scripts can *pretend* they persist and
> will never know the difference.
>
>> Objects by definition have state and behavior. Only the state can
>> persist between transactions; behavior never can - which is why
>> objects need to be reconstructed.
>
> Behaviour is "the methods". And they surely persist since the source
> files are not destroyed after each request. All instances of a class
> share the same methods, after all.
>

No, you cannot use those methods to act on the data while it is
serialized, i.e. on disk or in a database. Only the state is present.

To use those methods, you need to create a new object using that state
data.

It is a huge difference which true OO languages handle just fine. Only
PHP seems to have a problem with it.


>> Both __construct() and __clone() are types of constructors. __wakeup()
>> is not (unless you consider sleep() to be a destructor - see above).
>
> Why do you keep insisting that I must consider __sleep() to be a
> destructor if I consider __wakeup() to be a constructor?
>
> Consider:
>
> 1) __sleep() is called before the corresponding __wakeup() -- by your
> logic this would mean the destructor is called before the constructor
>
> 2) __sleep() is called on a different object than the corresponding
> __wakeup() -- so it cannot be the destructor corresponding to __wakeup()
>
> 3) __sleep() does not destroy anything. On the contrary, it helps to
> preserve something. It is therefore not a destructor.
>
> Greetings,
> Thomas
>

If you are considering __wakeup() to be a constructor, then __sleep(),
being exactly the opposite, would be a destructor. (why do you think
they are called "sleep" and "wakeup" if the designers didn't consider
them to be opposites?).

And what you're saying is that the destructor (__sleep()) is called
after a constructor (__construct(), __clone() or __wakeup()).



--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
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
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: 5.4 windows installer.
Next Topic: Does PHP5 treat $_SERVER['PHP_AUTH_USER']) differently?
Goto Forum:
  

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

Current Time: Thu Nov 28 10:41:22 GMT 2024

Total time taken to generate the page: 0.04542 seconds