Re: Implementation (simple!) operator overloading
| From: | ggInternet) | Date: | Mon, 10 Jul 2000 08:17:14 +0000 |
| Subject: | Re: Implementation (simple!) operator overloading | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-24006@lists.php.net to get a copy of this message | ||
On Mon, 10 Jul 2000, Emiliano wrote:
>
>
> > Well actually, you can do some funny stuff
> > adding and substracting (property) strings..
> >
> > ($object->string = $object - 10)
> > (I'm kinda working on the $object -= 10; )
>
> Funny being the right term here. Without some extensive context, this
> doesn't (intuitively) mean anything at all to me. Even in an 'obvious'
> case like $object being, e.g., a date, what does '10' mean? Days? Seconds?
>
> > Anyway, I see there isn't much interest for it, so it was a nice
> > exercise anyways.. I'm interested in improving PHP's OO capabilities
> > but I get the feeling OO is not really wanted in PHP by the developers
> > in here, this true?
>
> I like OO capabilities in PHP, am using them more and more. But operator
> overloading != OOP.
Well, in my implementation it is, you can only specify
operator overloading functions in a class and for now
in this situation: $c = $a + $b; It'd only work when $a == IS_OBJECT;
This way: $c = 10 + 10; isn't getting a different meaning.
class test { function overload+ test () { /*overload + operator*/ } }
This is the way it works right now.. (code is done, yes.)
But ehm, the PHP OO stuff like I would be willing to add stuff
to it, since I like messing around with it.. But I'd fall back on
C++ features again, private vars, protected vars, public vars..
With you all loving java I figure you don't like this, do you :-)
Mathieu
>
> Emile
>
>
> --
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net
> For additional commands, e-mail: php-dev-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>