Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:2035 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 21212 invoked by uid 1007); 27 May 2003 12:46:34 -0000 Message-ID: <20030527124633.21176.qmail@pb1.pair.com> To: internals@lists.php.net References: <1053816554.355.13.camel@hasele> Date: Tue, 27 May 2003 15:46:05 +0300 Lines: 28 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-Posted-By: 213.35.239.68 Subject: Re: cast_object() handler From: stepzter@neti.tv ("Ants Aasma") "Sterling Hughes" 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