Hello Marcus,

> CD> switch/case removed and patch attached. Is it ok?
> CD> Should the method be named "to_string()", "tostring()" or
"__tostring()" ?
> CD> Do you commit it to CVS ?
>
> No. Last Problem i see is that even when to_string() is available the
default
> behavior can get called that seems wrong. If that function doesn't return
a
> string it's an error and it shouldn't fall back to default in that case.

Do you think it's an error even if the value returned got cast to string ?
I don't know how to throw an error/exception from inside the core of Zend2.
I have some code to throw an exception/error from extensions...

> However with that last change the thing would be ok from my point of view.
> Perhaps you could also add an interface for that function as sterling once
> suggested. But still you need to discuss this with the rest of the ppl
here.
> Because eventually we might want to do it with overloadable object
handlers.

I modified the code to just call to_string if the object implements the
"printable" interface.
But I don't know how and where to register the interface in ZE2. Are there
any interfaces registered inside ZE2? I cound't find any...

If you could point me some code to dig...

Cristiano Duarte



-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to