Re: cast_object() handler

From: Date: Tue, 27 May 2003 12:46:05 +0000
Subject: Re: cast_object() handler
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-2035@lists.php.net to get a copy of this message
"Sterling Hughes" <sterling@bumblebury.com> wrote in message news:1053816554.355.13.camel@hasele... > Hi, > > Attached is a patch which allows one to intercept calls to object > casting within the engine. This means that whenever an object is > converted to a base type (except array, which has different semantics), > a special object handler is called instead of the default conversion > function. ... > Attached is a patch that makes this so. It only affects objects, and it > is only a internal syntax (not exported to userspace). Every other > place in the code that doesn't exploit this callback (sets it to NULL) > will continue to operate as normal. Why not export this to userspace? At least for ZE2. This would allow for some pretty nice codeconstructs with probably negligible performance hit, and close to zero BC problems. For example if __toString() is defined in a class then that function is called if an instance of that class is used in string context. Actually thought of this independently a couple of hours ago, sorry if this has been discussed. ------------- Ants Aasma

« previous php.internals (#2035) next »