Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:14588 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 63140 invoked by uid 1010); 3 Feb 2005 19:38:24 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 63119 invoked from network); 3 Feb 2005 19:38:24 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Feb 2005 19:38:24 -0000 X-Host-Fingerprint: 80.74.107.235 mail.zend.com Linux 2.4/2.6 Received: from ([80.74.107.235:56992] helo=mail.zend.com) by pb1.pair.com (ecelerity HEAD (r4105:4106)) with SMTP id 01/86-10528-DAD72024 for ; Thu, 03 Feb 2005 14:38:22 -0500 Received: (qmail 27010 invoked from network); 3 Feb 2005 19:38:18 -0000 Received: from shire.zend.office (10.1.2.160) by internal.zend.office with SMTP; 3 Feb 2005 19:38:18 -0000 Date: Thu, 3 Feb 2005 21:38:17 +0200 (IST) X-X-Sender: frodo@shire.zend.office To: =?iso-8859-1?Q?Terje_Sletteb=F8?= cc: internals@lists.php.net In-Reply-To: <00bc01c50a1f$c000a9a0$0300000a@pc> Message-ID: References: <5.1.0.14.2.20050201111730.0299da70@localhost> <42020015.5090209@cschneid.com> <02d901c50a0c$b2c0c3f0$a900000a@adstate.local> <00bc01c50a1f$c000a9a0$0300000a@pc> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: Re: [PHP-DEV] PHP 5.1 - operator overloading From: stas@zend.com (Stanislav Malyshev) TS>>When you say "typeless", i think you mean "not statically typed". I've been Not only, but in this case it is the main trait I meant. TS>>through this discussion elsewhere - a variable will at any one time have a TS>>well-defined type (or unset), which you may overload on, so the language is That's the whole point - in PHP there's no mechanism you could overload function based on the types of their parameters, neither statically nor dynamically. To add this thing would be a very major change and will open galactic-size can of worms (think "implicit conversions", "converting constructors", "multiple inheritance", etc.). And this would seriously complicate function call logic - which is very bad, because, unlike statically-typed language, we can not offload this complexity to one-time compile stage. TS>>Yes, variables are dynamically typed, but when you call a function, you TS>>typically have an idea of what its type is. Otherwise, the "type hints" for TS>>PHP 5 would be pointless! By your argument. Type hints check if the argument passed to function is of the right type. They don't make PHP call different functions on different argument types. TS>>That's right, so we'd really need function overloading to be able to use the TS>>free function form, which I think is another good idea (function TS>>overloading). See above. TS>>> - except for select things like TS>>> complex and matrices (and maybe two more things like this) I don't see any TS>>> value in having, say, + overloaded. Using good old methods will never fail TS>>> you. TS>> TS>>Neither will assembly code. What is with that assembly code that you keep mentioning it? Assembly code is entirely irrelevant to the discussion, since, as I already explained once, difference between assebmly code and higher-level programming languages in in complexity incapsulation, while difference between operator overloading and using method is purely syntactical - operator overloading can be translated one-to-one to method calls without exposing any complexity, while translating method call to assemly exposes a lot of complexity. -- Stanislav Malyshev, Zend Products Engineer stas@zend.com http://www.zend.com/ +972-3-6139665 ext.115