Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:93844 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 94915 invoked from network); 6 Jun 2016 13:32:10 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Jun 2016 13:32:10 -0000 Authentication-Results: pb1.pair.com header.from=lester@lsces.co.uk; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=lester@lsces.co.uk; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain lsces.co.uk from 217.147.176.214 cause and error) X-PHP-List-Original-Sender: lester@lsces.co.uk X-Host-Fingerprint: 217.147.176.214 mail4-2.serversure.net Linux 2.6 Received: from [217.147.176.214] ([217.147.176.214:38460] helo=mail4.serversure.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 94/43-10476-75B75575 for ; Mon, 06 Jun 2016 09:32:08 -0400 Received: (qmail 11038 invoked by uid 89); 6 Jun 2016 13:32:05 -0000 Received: by simscan 1.3.1 ppid: 11032, pid: 11035, t: 0.0994s scanners: attach: 1.3.1 clamav: 0.96/m:52/d:10677 Received: from unknown (HELO ?10.0.0.7?) (lester@rainbowdigitalmedia.org.uk@81.138.11.136) by mail4.serversure.net with ESMTPA; 6 Jun 2016 13:32:05 -0000 To: internals@lists.php.net References: <3B.01.10476.B3865575@pb1.pair.com> Message-ID: <57557B54.2080704@lsces.co.uk> Date: Mon, 6 Jun 2016 14:32:04 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.0 MIME-Version: 1.0 In-Reply-To: <3B.01.10476.B3865575@pb1.pair.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Re: Opinion on function/method name overloading From: lester@lsces.co.uk (Lester Caine) On 06/06/16 13:10, Andrea Faulds wrote: > > However, we already have solutions for both of these in PHP. PHP's > functions and methods can have optional parameters for which you do not > have to provide an argument, and because PHP is dynamically-typed, a > parameter can accept an argument of any type (and within the function > body discriminate between types) if it needs to. Also, PHP has fewer and > more generalised types than some other languages do, so where a C# > method might have overloaded versions taking a UInt8, UInt16, UInt32, > SInt8, SInt16 and so on, an equivalent PHP method might only take PHP's > single universal integer type. This used the be the reason PHP worked so well ... one did NOT have to worry about how a parameter was provided, and even today one is *NOT* providing a binary 'int' even if you 'type' the value to be such. The whole point of a compiled language being able to provide several versions of the same function but with different binary parameter sizes and types is hopefully something that will never trouble PHP? PHP is not building a binary parameter stack for the function call. function foo($a) {} is still the natural way of doing things if the FIRST validation step is '$a between 1 and 10' and adding the 'int' does nothing to change the work flow of handling $a in my book ... just loads the process with additional checks which often have to be duplicated internally anyway to maintain a proper flow through the process. -- Lester Caine - G8HFL ----------------------------- Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk Rainbow Digital Media - http://rainbowdigitalmedia.co.uk