Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:32757 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 81651 invoked by uid 1010); 14 Oct 2007 14:49:51 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 81636 invoked from network); 14 Oct 2007 14:49:51 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Oct 2007 14:49:51 -0000 Authentication-Results: pb1.pair.com smtp.mail=rasmus@lerdorf.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=rasmus@lerdorf.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain lerdorf.com from 204.11.219.139 cause and error) X-PHP-List-Original-Sender: rasmus@lerdorf.com X-Host-Fingerprint: 204.11.219.139 mail.lerdorf.com Received: from [204.11.219.139] ([204.11.219.139:44258] helo=mail.lerdorf.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 72/91-02105-E8C22174 for ; Sun, 14 Oct 2007 10:49:51 -0400 Received: from trainburn-lm-corp-yahoo-com.local (c-24-6-228-50.hsd1.ca.comcast.net [24.6.228.50]) (authenticated bits=0) by mail.lerdorf.com (8.14.1/8.14.1/Debian-10) with ESMTP id l9EEnhbw020839 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Sun, 14 Oct 2007 07:49:43 -0700 Message-ID: <47122C7E.3060301@lerdorf.com> Date: Sun, 14 Oct 2007 07:49:34 -0700 User-Agent: Thunderbird 2.0.0.6 (Macintosh/20070728) MIME-Version: 1.0 To: Christian Schneider CC: Marcus Boerger , internals@lists.php.net References: <7C37FF3A0196094F95430BA95952032211B7C5@s1.mkj.lan> <7C37FF3A0196094F95430BA95952032211B7C7@s1.mkj.lan> <72129346.20071014092922@marcus-boerger.de> <47120B07.3070801@cschneid.com> In-Reply-To: <47120B07.3070801@cschneid.com> X-Enigmail-Version: 0.95.3 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV 0.91.2/4540/Sat Oct 13 18:43:55 2007 on colo.lerdorf.com X-Virus-Status: Clean Subject: Re: AW: [PHP-DEV] Method overloading by method signature From: rasmus@lerdorf.com (Rasmus Lerdorf) Christian Schneider wrote: > Marcus Boerger wrote: >> If you have such a patch you should definitively post it here so >> that we >> can hve a look. Most interesting to us is however the oerformance >> impact. As >> that was the main reason to go any further than adding return type hints. > > Am I the only here who thinks that performance is not the major issue > with this approach? > > Method signatures lead to a different style of programming I personally > wouldn't want to encourage in PHP. > > I'm expecting some kind of "if you don't like it don't use it" answer > but I wouldn't want to bloat the language for such a feature anyway. > > Example: > It's too easy for someone to think it's a good idea to change > function foo($x) { ... } > to something like > function foo(string $x) { ... } > function foo(int $x) { ... } > but this can lead to very subtle bugs as automatic type conversion can > trick you into passing something different than you thought and hence > could lead you to do > foo(strval($x)); > all over the place to not get any surprises. A Bad Thing(TM) IMHO. Yup, I agree. Having to sit and count arguments and figure out the types in order to determine which actual method is being called makes it damn near impossible to debug code as far as I am concerned. And what does the callgraph from a profiler look like? kcachegrind doesn't show the function signature in the callgraph which means we would have to map these methods to some unique name and people would have to know how to map these names back to the correct function signature. Sounds like a mess to me. -Rasmus