"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