Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:80452 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 64993 invoked from network); 14 Jan 2015 10:09:10 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Jan 2015 10:09:10 -0000 Authentication-Results: pb1.pair.com header.from=thomas@nunninger.info; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=thomas@nunninger.info; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain nunninger.info from 87.106.55.207 cause and error) X-PHP-List-Original-Sender: thomas@nunninger.info X-Host-Fingerprint: 87.106.55.207 mail.nunninger.info Linux 2.6 Received: from [87.106.55.207] ([87.106.55.207:53418] helo=mail.nunninger.info) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F5/B0-61073-34046B45 for ; Wed, 14 Jan 2015 05:09:08 -0500 Received: from pd95c6425.dip0.t-ipconnect.de ([217.92.100.37] helo=[192.168.178.30]) by mail.nunninger.info with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.69) (envelope-from ) id 1YBKsW-0002AA-9B; Wed, 14 Jan 2015 10:08:48 +0000 Message-ID: <54B6402B.1020401@nunninger.info> Date: Wed, 14 Jan 2015 11:08:43 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: Andrea Faulds , Leigh CC: PHP Internals List References: <8DCD1B72-C81D-499E-B455-E4A042CD76E6@ajf.me> <4E2073DE-0951-498C-97BB-DDAC094F11FA@ajf.me> In-Reply-To: <4E2073DE-0951-498C-97BB-DDAC094F11FA@ajf.me> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: -0.3 (/) X-Spam-Several-Recipients: Yes Subject: Re: [PHP-DEV] [RFC] Scalar Type Hints v0.2 From: thomas@nunninger.info (Thomas Nunninger) Hi, On 01/14/2015 10:32 AM, Andrea Faulds wrote: > Hi Leigh, > >> On 14 Jan 2015, at 09:17, Leigh wrote: >> >> I really don't like this behaviour being changed at the call site. If >> I design a function that I _know_ should only take a string, then I >> want it to be an error if the user supplies anything else, so that >> they know they messed up. > > I don’t like the idea of being forced to use strict (or weak) type checking because the API author decided as much. What happens with that code: ---------------- $i = 1; $a = myFunc( $i ); declare(strict_typehints=TRUE); function myFunc( float $f ) { return otherFunc( $f ); } function otherFunc( float $f ) { ... } ---------------- As author of strict code I need to replace return otherFunc( $f ); by return otherFunc( (float) $f ); I'm not sure - if this is what a strict coder wants and - if you find an acceptable way to test your strict code if it works with non-strict code. Regards Thomas