> On Thu, 3 Feb 2005 11:47:13 +0100 (CET)
> [EMAIL PROTECTED] (Derick Rethans) wrote:
>
> > On Thu, 3 Feb 2005, Sebastian Bergmann wrote:
> >
> > > Derick Rethans wrote:
> > > > Use C++/Java if you want this.
> > >
> > > Java does not support operator overloading.
> >
> > So, that means PHP shouldn't get it either, right? ;-)
>
> As I already asked in the past, I'm in favour to have them for
> intern usage only (understand used by extension).
Internal in what way? And why?
> As we already for
> propoerties read or write. For those who do not know, you have no
> way to know that you in a ++, -- call. At least for ++,-- and
> friends.
I'm not sure I understood the above, but if I understood it right, why would
that be?
class SomeClass
{
function operator++() // #1
{
return ++$this->value;
}
function operator($dummy) // #2 ***
{
return $value++;
}
var $value;
}
$object=new SomeClass();
++$object; // Calls #1
$object++; // Calls # 2
(***) This is how it's done in C++ (actually, a dummy int parameter), which
is a bit of a hack, to be able to specify both the pre- and
post-increment/decrement operators. #2 (and postfix "--") is the "odd" one,
since they are the only postfix operators among the operators.
Regards,
Terje
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php