Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:36868 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 344 invoked from network); 8 Apr 2008 10:54:17 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Apr 2008 10:54:17 -0000 Authentication-Results: pb1.pair.com header.from=cschneid@cschneid.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=cschneid@cschneid.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain cschneid.com from 195.141.85.118 cause and error) X-PHP-List-Original-Sender: cschneid@cschneid.com X-Host-Fingerprint: 195.141.85.118 uf2.search.ch Linux 2.6 Received: from [195.141.85.118] ([195.141.85.118:46890] helo=smtp.rim.ch) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 4D/5E-22202-5DE4BF74 for ; Tue, 08 Apr 2008 06:54:15 -0400 Received: from localhost (localhost [127.0.0.1]) by rolig.search.ch (Postfix) with ESMTP id 1228ECF1D6 for ; Tue, 8 Apr 2008 12:54:10 +0200 (CEST) Received: from smtp.rim.ch ([127.0.0.1]) by localhost (search.ch [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 09546-09 for ; Tue, 8 Apr 2008 12:54:07 +0200 (CEST) Received: from [192.168.1.72] (ultrafilter2-i [192.168.85.3]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by rolig.search.ch (Postfix) with ESMTP id DC4411ABF52 for ; Tue, 8 Apr 2008 12:54:07 +0200 (CEST) Message-ID: <47FB4ECE.6010406@cschneid.com> Date: Tue, 08 Apr 2008 12:54:06 +0200 User-Agent: Thunderbird 1.5.0.12 (X11/20060911) MIME-Version: 1.0 To: internals Mailing List References: <1207539695.5736.42.camel@pena> <8d7b8c130804062157j60871630r6c3b27c4d3245cb9@mail.gmail.com> <1207576676.5331.49.camel@felipe> <47FA507D.2070108@cschneid.com> <10845a340804071346m251eae49j907b4a6ca7c607be@mail.gmail.com> <47FA94B2.6050704@cschneid.com> <9b3df6a50804080202n456fc08blfef3e70034d95c1c@mail.gmail.com> <47FB3830.2080907@arcada.fi> In-Reply-To: <47FB3830.2080907@arcada.fi> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Virus-Scanned: amavisd-new at search.ch Subject: Re: [PHP-DEV] Return type hints From: cschneid@cschneid.com (Christian Schneider) Actually nothing could support my point about giving the wrong signals better than these two postings: They are IMHO on the wrong track on how to make an interface better. Krister Karlström wrote: > This is maybe getting a bit out of topic now, but what about > function/method overloading using type hinting: > > function myfunc(string $data) { } > function myfunc(int $data) { } > function myfunc(myClass $data) { } Go back to Java please ;-) > Arvids Godjuks wrote: >> I think type hint's would be good optional functionality. Those who need >> will use it, others will not. I'd probably use it in some cases. >> Especially if named parameters are implemented. >> >> Sometimes what I really want is named parameter pass like >> >> function myfunc(array $array, string $string = null, int $someint = 0){ >> } >> >> myfunc($myArray, someint = $mySomeInt); While I think named parameters are a good idea I pointed out in older postings that I think this is a very crippled approach to it: You still have to define all the parameters you are going to accept. The real power and flexibility comes in if you accept (and handle) arbitrary argument lists. See http://itools.search.ch/ for an example of what I mean. Okay, enough evangelism for today, back to work :-) - Chris