Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:14563 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 56228 invoked by uid 1010); 3 Feb 2005 10:42:36 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 56213 invoked from network); 3 Feb 2005 10:42:36 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Feb 2005 10:42:36 -0000 X-Host-Fingerprint: 195.141.85.118 uf2.search.ch Linux 2.4/2.6 Received: from ([195.141.85.118:60601] helo=xaxa.search.ch) by pb1.pair.com (ecelerity HEAD (r4105:4106)) with SMTP id F3/43-23393-B1002024 for ; Thu, 03 Feb 2005 05:42:35 -0500 Received: from localhost (localhost [127.0.0.1]) by xaxa.search.ch (Postfix) with ESMTP id CE31C6D8B8; Thu, 3 Feb 2005 11:42:32 +0100 (CET) Received: by xaxa.search.ch (Postfix, from userid 65534) id 88E836D8CB; Thu, 3 Feb 2005 11:42:31 +0100 (CET) Received: from [192.168.0.42] (ultrafilter2-i [192.168.85.3]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by xaxa.search.ch (Postfix) with ESMTP id 40F146D8B8; Thu, 3 Feb 2005 11:42:30 +0100 (CET) Message-ID: <42020015.5090209@cschneid.com> Date: Thu, 03 Feb 2005 11:42:29 +0100 User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20041220 X-Accept-Language: en-us, en, de-ch, de, fr-ch MIME-Version: 1.0 To: Derick Rethans Cc: Sebastian Bergmann , internals@lists.php.net References: <5.1.0.14.2.20050201111730.0299da70@localhost> In-Reply-To: X-Enigmail-Version: 0.89.6.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Checker-Version: SpamAssassin 2.64 (2004-01-11) on xaxa.search.ch X-Spam-Level: X-Spam-Status: No, hits=-4.9 required=5.0 tests=BAYES_00 autolearn=ham version=2.64 X-Virus-Scanned: by AMaViS 0.3.12pre8 Subject: Re: [PHP-DEV] PHP 5.1 From: cschneid@cschneid.com (Christian Schneider) Derick Rethans wrote: > On Thu, 3 Feb 2005, Sebastian Bergmann wrote: > >>Derick Rethans wrote: >>>This adds operator overloading to user classes? >> Yes, have a look at Johannes' Complex example [1]. > > Okay, mega Yuck then. Although it looks cool, I consider it as a bad > practise. It confuses the hell out of people that they can add two > objects. Use C++/Java if you want this... I couldn't agree more. I like PHP not because it is the most compact or flexible of all languages but because the syntax is quite simple. Try explaining someone who just learned PHP and doesn't know your code where to find the implementation of $c = $a + $b; as opposed to $c= $a->add($b); or $c = Complex::add($a, $b); Another little thought how confusion can easily happen with operator overloading: $b = $a + 42; works but $b = 42 + $a; doesn't, i.e. the overloaded addition isn't commutative. Just my 2 Rappen, - Chris