Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:80525 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 44163 invoked from network); 15 Jan 2015 09:02:23 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Jan 2015 09:02:23 -0000 Authentication-Results: pb1.pair.com smtp.mail=lester@lsces.co.uk; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=lester@lsces.co.uk; 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:43666] helo=mail4.serversure.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 61/D4-14306-D1287B45 for ; Thu, 15 Jan 2015 04:02:22 -0500 Received: (qmail 31630 invoked by uid 89); 15 Jan 2015 09:02:16 -0000 Received: by simscan 1.3.1 ppid: 31621, pid: 31626, t: 0.0751s scanners: attach: 1.3.1 clamav: 0.96/m:52/d:10677 Received: from unknown (HELO ?10.0.0.8?) (lester@rainbowdigitalmedia.org.uk@86.160.91.166) by mail4.serversure.net with ESMTPA; 15 Jan 2015 09:02:16 -0000 Message-ID: <54B78217.4080506@lsces.co.uk> Date: Thu, 15 Jan 2015 09:02:15 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: PHP internals References: <8DCD1B72-C81D-499E-B455-E4A042CD76E6@ajf.me> <4E2073DE-0951-498C-97BB-DDAC094F11FA@ajf.me> <9a033dd1f223f854e760924d118ab812@mail.gmail.com> <2ae0164cb9b9bf1c974d7a3c60af0466@mail.gmail.com> <54B77A7C.406@lsces.co.uk> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] [RFC] Scalar Type Hints v0.2 From: lester@lsces.co.uk (Lester Caine) On 15/01/15 08:49, Pavel KouĊ™il wrote: >> One of the nice features of PHP when I started using it all those years >> > ago was that I did not have to create separate functions different types >> > did exist in the source data. int/float/num/double and others all needed >> > separate handling in c/c++, and one could not easily add a different >> > 'type' of data. >> > > If you have a function which requires a "double" in C# (a strongly > typed language), you can safely pass int to the function and it will > work, because you are not narrowing the possible values. So making the > PHP accept only the argument if its type is exactly the same as the > parameter (paraphrased from RFC for the strict version of type hints) > seems like a step in a wrong direction. If I'm not mistaken, Java > behaves the same way. How exactly does it work in C++ and C? I haven't > used C in years, so I'm a little bit rusty on this detail. I'm going back 15 years here ;) I still have code with several functions which are essentially the same because they wrap the same core function, but on moving to PHP all the wrappers fall away and one just adds the 'conversion/validation' in the function. e_strict has already brought back the need for extra versions of functions for static and dynamic access and adding typing potentially extends that. -- 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