Hi,

> > First why not name it toString() since for now we have consensus on sudlyCaps.
> > But i didn't bother with names yet when i made this patch:
> > http://marcus-boerger.de/php/ext/ze2/ze2-iterators-20030902.diff.txt
> 
> I chose '__string' to follow the existing convention for "special"
> method names (e.g. __construct, __clone, __call).  Also, I suspect
> that many developers are already using toString() methods in their
> classes, and I'm not sure we want to use them directly with having
> them think about the semantics of their decision first.

__string() is fine with me, since in analogy to Java, toString() is prone 
to have arbitrary meanings in comparison with a simple overloaded cast 
operation.

> > Second i think you should use the cast facility like i did in my patch.
>  
> I looked at the cast facility briefly and decided not to use it
> because it meant including a new zend_std_* implementation for casting
> (that function entry is currently NULL in zend_object_handers.c).

I need this functionality to implement i18n'ed string class, so 
I'll reimplement your patch to use the default cast facility if necessary.

BTW, how about allowing zend_object_cast() to return a boolean value and
decide whether to use the default casting behaviour or the modified
one, Marcus? This seems to reduce such redundant effort.

Moriyoshi

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

Reply via email to