Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:32762 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 31053 invoked by uid 1010); 14 Oct 2007 18:40:32 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 31038 invoked from network); 14 Oct 2007 18:40:32 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Oct 2007 18:40:32 -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.226.6.51 cause and error) X-PHP-List-Original-Sender: cschneid@cschneid.com X-Host-Fingerprint: 195.226.6.51 darkcity.gna.ch Linux 2.6 Received: from [195.226.6.51] ([195.226.6.51:51359] helo=mail.gna.ch) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 31/87-02105-D9262174 for ; Sun, 14 Oct 2007 14:40:31 -0400 Received: from localhost (localhost [127.0.0.1]) by darkcity.gna.ch (Postfix) with ESMTP id EEA20130ABE; Sun, 14 Oct 2007 20:40:26 +0200 (CEST) Received: from unknown by localhost (amavisd-new, unix socket) id client-XXcsHzsv; Sun, 14 Oct 2007 20:40:25 +0200 (CEST) Received: from box.local (77-57-14-223.dclient.hispeed.ch [77.57.14.223]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by darkcity.gna.ch (Postfix) with ESMTP id A4E9512EC22; Sun, 14 Oct 2007 20:40:25 +0200 (CEST) Message-ID: <47126293.6070205@cschneid.com> Date: Sun, 14 Oct 2007 20:40:19 +0200 User-Agent: Thunderbird 2.0.0.6 (Macintosh/20070728) MIME-Version: 1.0 To: Hans Moog CC: PHP Developers Mailing List References: <7C37FF3A0196094F95430BA95952032211B7C5@s1.mkj.lan> <7C37FF3A0196094F95430BA95952032211B7C7@s1.mkj.lan> <72129346.20071014092922@marcus-boerger.de> <47120B07.3070801@cschneid.com> <7C37FF3A0196094F95430BA95952032211B7CD@s1.mkj.lan> In-Reply-To: <7C37FF3A0196094F95430BA95952032211B7CD@s1.mkj.lan> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: amavisd-new at gna.ch Subject: Re: AW: AW: [PHP-DEV] Method overloading by method signature From: cschneid@cschneid.com (Christian Schneider) Hans Moog wrote: > You are missing something. Using this new feature would be > voluntarily (it is optional like type hints are already). Thanks for bringing that up right after I told you that I won't accept this argument ;-) > If you want to code the old way and you don't want to force coders to > use your functions correctly, you could leave out typehints an check > the parameters manually. We don't check the parameters. Automatic type conversion does the right thing for us in 99% of the case and the other 1% is handled manually. Not checked, handled. Please note the difference. > You do not use type hints in your functions, thats why you don't > understand the need of overloding methods by parameter siganture. If > you would understand the need of type hints for robust applications > you would understand the need of overloading typehinted methods. I disagree here: 1. Type hints are not needed for robust applications. That's a myth. They don't even make it easier IMHO. 2. Overloading is not necessary, you can use different names if you want different flavours of a method. That's clearer and easier to debug (I can search in the source code for a function name but not for a parameter signature). > Btw: You could call foo((integer) $x); to ensure the right method is > called. That's *exactly* what I want to avoid. Your code ends up being messy for no good reason: Solving a problem you created yourself. > Like I already said, this feature is only require for people writing > complex web applications, offering api's to 3rdparty coders that are > very strict. If you are coding a project within your company you can > rely on the fact, that programmers should know how to use your > methods, but a 3rdparty coder who extends the functionality of your > product doesn't know and there should be no chance to crash the > application. I don't think we would agree on what's a complex web application here (complex being a negative term for me, I'd rather write a simple but advanced web application) but even then the API should be simple. And simple APIs don't need whips and chains. And I don't believe in fool proof APIs, only fools can use those ;-) - Chris