Re: [Operators overloading] PHP 5.1
| From: | Pierre-Alain Joye | Date: | Thu, 03 Feb 2005 18:59:11 +0000 |
| Subject: | Re: [Operators overloading] PHP 5.1 | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-14582@lists.php.net to get a copy of this message | ||
On Thu, 3 Feb 2005 18:12:44 +0100
tslettebo@broadpark.no (Terje Slettebø) wrote:
> > On Thu, 3 Feb 2005 11:47:13 +0100 (CET)
> > derick@php.net (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?
Available for extensions only (means also not in user land), like
the get/set get_properties for objects.
> > 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?
For now you cannot know if are in a '++' or a '--'. The operations
(I have to check that again :) are:
$b->a++; gives tmp = a; tmp = tmp+1; b->a = tmp;
In my example (a date object, day being 31), at this I do not know
if one is assigning 32 to the property or if it's the result of
incrementation (or decrementation from 1 to 0).
Regards,
--Pierre