Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:14575 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 22055 invoked by uid 1010); 3 Feb 2005 17:21:12 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 21958 invoked by uid 1007); 3 Feb 2005 17:21:11 -0000 Message-ID: <20050203172111.21953.qmail@lists.php.net> To: internals@lists.php.net Date: Thu, 03 Feb 2005 18:20:51 +0100 References: <5.1.0.14.2.20050201111730.0299da70@localhost> Lines: 34 User-Agent: KNode/0.8.0 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Posted-By: 62.158.194.170 Subject: Re: [PHP-DEV] PHP 5.1 From: johannes@php.net (Johannes Schlueter) Hi, Not wanting to discuss the pros and cons of operator overloading in PHP a few notes about the implementation: Stanislav Malyshev wrote: > 2. The referenced patch raises doubts - why it allows to override / but > not %, for example? What with all other operators? Why add would work as I've written the patch mainly for learning about PHP and the Zend Engine as a proof-of-concept and not as a thing I would like to propose so I was satisfied when it was running. By showing it to a few people I got some feedback about the way I've implemented it and learned how to do it better. Most of this input ended at my brain not in the patch so it's far from good, I still stress that I'm no C coder ;-) So all what's (not) there needs to be seen from that position. For being committed it would need some work. > $foo + 1, but 1 + $foo won't? Will + be non-commutative operation from now In case of operator overloading this would become true - not for simple types - when leaving the field of simple numbers an "addition operation" isn't allways communitative. Think on "adding" two strings - you would expect different results from "foo"+"bar" and "bar"+"foo". (Yes, I know that PHP has the concat operator . so this is just an example) > on? What with assign-ops - it would leak memory in this case? As said it's in proof-of-concept state. I last looked over it during the conference in Frankfurt and afair at least --enable-debug didn't report a leak ;-) Enough (if not even too much) for the moment, johannes