Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:32771 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 97061 invoked by uid 1010); 15 Oct 2007 08:23:28 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 97046 invoked from network); 15 Oct 2007 08:23:28 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Oct 2007 08:23:28 -0000 Authentication-Results: pb1.pair.com smtp.mail=rquadling@googlemail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rquadling@googlemail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain googlemail.com designates 209.85.198.189 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: rquadling@googlemail.com X-Host-Fingerprint: 209.85.198.189 rv-out-0910.google.com Received: from [209.85.198.189] ([209.85.198.189:5905] helo=rv-out-0910.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B9/35-02105-D7323174 for ; Mon, 15 Oct 2007 04:23:27 -0400 Received: by rv-out-0910.google.com with SMTP id k15so1404698rvb for ; Mon, 15 Oct 2007 01:23:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=tDEHBGw+lZnOeVj6Ta5k2x1UYlRd4ouJBNu3CCErETo=; b=dAwFj2YBAg9EzzAn/oEtjAbz8lqGhfl0uUZrI51QyJqz3uNg2lfB8f5tOWY4xpKR8Sb64mAnU/C23ZJH+3TZECZG8sHlm2vsGXXOQfRE0+j/EpH+rw3s6bCBk1D2X6amNrSeOMYgbt/TKdNGt13OUGcYLjizyU00HyYChJE/uUY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=beta; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=EJzt+EqqNso8cm/HJ4XQ73WAoNxS147SHYp7Zz4nXMS6zgBbbVQGycJwbuGMyxvZN9MGEmA4SEbz8TJfR5aupmRlUFpLPwvs0JGCLX4Pefygs6jrAzCbXG4HSypoYfGp3ZbvaslkwJXge3a5xJSBwabYdpFogOwNWeZV+0v+Ahc= Received: by 10.115.90.1 with SMTP id s1mr6695337wal.1192436602712; Mon, 15 Oct 2007 01:23:22 -0700 (PDT) Received: by 10.115.59.1 with HTTP; Mon, 15 Oct 2007 01:23:22 -0700 (PDT) Message-ID: <10845a340710150123vf56dc6au5ceb72917797ddf0@mail.gmail.com> Date: Mon, 15 Oct 2007 09:23:22 +0100 Reply-To: RQuadling@GoogleMail.com To: "Hans Moog" Cc: "Christian Schneider" , internals@lists.php.net In-Reply-To: <7C37FF3A0196094F95430BA95952032211B7CD@s1.mkj.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <7C37FF3A0196094F95430BA95952032211B7C5@s1.mkj.lan> <7C37FF3A0196094F95430BA95952032211B7C7@s1.mkj.lan> <72129346.20071014092922@marcus-boerger.de> <47120B07.3070801@cschneid.com> <7C37FF3A0196094F95430BA95952032211B7CD@s1.mkj.lan> Subject: Re: AW: [PHP-DEV] Method overloading by method signature From: rquadling@googlemail.com ("Richard Quadling") On 14/10/2007, Hans Moog wrote: > You are missing something. Using this new feature would be voluntarily (it is optional like type hints are already). > > 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. > > But if you want to write strict API's, that accept only a special type of parameters (and type hinted parameters were introduced to be able to do this) you would still be able to accept more than one type of parameters (without this additional feature you are not able to do it right now). > > > 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. > > > Btw: You could call foo((integer) $x); to ensure the right method is called. > > 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. For what it is worth, I would find this functionality EXTREMELY useful. The classes I create ARE used by other developers both within my organisation and outside and as I'm currently porting GUI apps from Delphi to web apps using PHP and missing things like type hinting of scalars AND overloaded function defs is a pain as I now have 1 method with a header which has to parse the parameter types to determine what is required to be called. I think this is a GREAT feature. Even if it was JUST for E_STRICT OOP code. -- ----- Richard Quadling Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731 "Standing on the shoulders of some very clever giants!"