Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:25615 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 84451 invoked by uid 1010); 11 Sep 2006 17:40:28 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 84436 invoked from network); 11 Sep 2006 17:40:28 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Sep 2006 17:40:28 -0000 Authentication-Results: pb1.pair.com smtp.mail=tslettebo@broadpark.no; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=tslettebo@broadpark.no; sender-id=unknown Received-SPF: error (pb1.pair.com: domain broadpark.no from 80.202.4.58 cause and error) X-PHP-List-Original-Sender: tslettebo@broadpark.no X-Host-Fingerprint: 80.202.4.58 osl1smout1.broadpark.no Solaris 9 Received: from [80.202.4.58] ([80.202.4.58:59249] helo=osl1smout1.broadpark.no) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 6D/81-02095-A8F95054 for ; Mon, 11 Sep 2006 13:40:28 -0400 Received: from osl1sminn1.broadpark.no ([80.202.4.59]) by osl1smout1.broadpark.no (Sun Java System Messaging Server 6.1 HotFix 0.05 (built Oct 21 2004)) with ESMTP id <0J5F00BI7VRB3L00@osl1smout1.broadpark.no> for internals@lists.php.net; Mon, 11 Sep 2006 19:40:23 +0200 (CEST) Received: from pc ([80.203.129.59]) by osl1sminn1.broadpark.no (Sun Java System Messaging Server 6.1 HotFix 0.05 (built Oct 21 2004)) with SMTP id <0J5F00KK3VRBTE93@osl1sminn1.broadpark.no> for internals@lists.php.net; Mon, 11 Sep 2006 19:40:23 +0200 (CEST) Date: Mon, 11 Sep 2006 19:40:29 +0200 To: Stanislav Malyshev , RQuadling@GoogleMail.com Cc: dAniel hAhler , internals@lists.php.net Message-ID: <004e01c6d5c9$5f9b16a0$9a02a8c0@pc> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1807 X-Mailer: Microsoft Outlook Express 6.00.2800.1807 Content-type: text/plain; charset=UTF-8 Content-transfer-encoding: 7BIT X-Priority: 3 X-MSMail-priority: Normal References: <015801c6d4d5$6440d1d0$9a02a8c0@pc> <7f3ed2c30609100744x7a5d4fdfs9601ae4671b351d3@mail.gmail.com> <003401c6d4ee$1b251d80$9a02a8c0@pc> <1803358544.20060910173549@marcus-boerger.de> <29.48.46429.82A54054@pb1.pair.com> <10845a340609110106y5a21de3coc98659cde5ef0465@mail.gmail.com> <450591E5.7080402@zend.com> Subject: Re: [PHP-DEV] Re: __autoloading and functions From: tslettebo@broadpark.no (=?UTF-8?Q?Terje_Sletteb=C3=B8?=) > >> Maybe a dump question, but wouldn't it get considered only, AFTER PHP has > >> found that the function does not exist? > > Technically, this can be done - i.e. engine can be patched so that > instead of throwing an error or refusing the call it would call > appropriate function which would allow for autoloading. > > However, I think autoloading functions if conceptually wrong. One rarely > keeps functions individually separated in different files (while this is > routinely happening - and is recommended - for classes). So, if you want > to autoload functions you would either have to build complex tables of > where each function lives or organize them in some well-defined modules. > Such modules are called "classes" in OO-speak Or "namespaces"... Or just plain "modules". Classes is not the only way to group things, and may not be the best (namespaces can typically be re-opened, so functions and classes belonging to a namespace can span several files, instead of everything having to be in _one_ file). >, so if you have a group of > functions that are united by purpose and you want to autoload - why not > to make a class out of them? Why? Besides the above, because you may want to be able to call a function like: f(); and not: SomeClassToWrapItAll::f(); ... Please, people: The availability of free (non-member) functions in PHP (as in C/C++) is one advantage it has over Java, where everything _has_ to be a class. So in Java, instead of being able to write "sqrt()", you have to write "Math::sqrt()". Always. And one small plea: If namespaces are added to PHP, please don't add something like C++'s "argument-dependent lookup": It has caused no end of problems in that camp. :) Regards, Terje