Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:14574 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 9105 invoked by uid 1010); 3 Feb 2005 17:13:37 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 9051 invoked from network); 3 Feb 2005 17:13:36 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Feb 2005 17:13:36 -0000 X-Host-Fingerprint: 80.239.127.2 unknown Windows 2000 SP4, XP SP1 Received: from ([80.239.127.2:2903] helo=utvikling.adstate.net) by pb1.pair.com (ecelerity HEAD (r4105:4106)) with SMTP id 37/3D-29932-5AB52024 for ; Thu, 03 Feb 2005 12:13:10 -0500 Message-ID: <02da01c50a13$93728720$a900000a@adstate.local> To: References: <5.1.0.14.2.20050201111730.0299da70@localhost> <20050203122955.292e6da9@localhost.localdomain> Date: Thu, 3 Feb 2005 18:12:44 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1437 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 Subject: Re: [PHP-DEV] [Operators overloading] PHP 5.1 From: tslettebo@broadpark.no (=?iso-8859-1?Q?Terje_Sletteb=F8?=) > 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? > 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