Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:79061 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 49813 invoked from network); 21 Nov 2014 02:11:37 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Nov 2014 02:11:37 -0000 Authentication-Results: pb1.pair.com smtp.mail=yohgaki@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=yohgaki@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.223.169 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.223.169 mail-ie0-f169.google.com Received: from [209.85.223.169] ([209.85.223.169:44879] helo=mail-ie0-f169.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3C/D2-32541-75F9E645 for ; Thu, 20 Nov 2014 21:11:35 -0500 Received: by mail-ie0-f169.google.com with SMTP id y20so4042022ier.14 for ; Thu, 20 Nov 2014 18:11:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=GcA8hQLUt1IDbPdPSY2gH2+SY/9OSrQJ84Zaul6k7Fs=; b=fRJKp1EOgem/OlkRb2xk7DnLPVPG05zRjzeUXcF2IRhcwYaQgE7tfJpEjqtuVGirJm hRXwDFVZSuSt6iBV2WS1W5Hp0Lv1LTHegpOhqZnImHceI0S77ymaq5qEyBmPSGmPdoCt elE+CM9ofMfU4CbZB6nW48IJXP2u0/TKq4f/SvOA3IdFR4vTs90rbp6afT0OHCmdxVKh a1ejziO4Eim2CCLsRYqgMRskmC8A8Onj/au6JXUudFTk8G5Rog1MlvBTy296g8sYV4U6 fJrzRpJadCcDTI+WXYeQBrG+fY9nuByukoE5Tyhi7tfjQ+WHbKHGkoXwqc+ZI7da2XXC vmiA== X-Received: by 10.50.79.166 with SMTP id k6mr1328476igx.0.1416535892364; Thu, 20 Nov 2014 18:11:32 -0800 (PST) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.107.164.217 with HTTP; Thu, 20 Nov 2014 18:10:52 -0800 (PST) In-Reply-To: References: <3A69F0F5-C5FE-415D-A894-193D9F146854@gmail.com> Date: Fri, 21 Nov 2014 11:10:52 +0900 X-Google-Sender-Auth: mH-x3rHIt1O1SFehc6yfHsR6jvs Message-ID: To: marcio3w@gmail.com Cc: David Muir , Adam Harvey , Levi Morrison , Andrea Faulds , PHP Internals Content-Type: multipart/alternative; boundary=089e013a114ead1745050854f63a Subject: Re: [PHP-DEV] [VOTE][RFC] Safe Casting Functions From: yohgaki@ohgaki.net (Yasuo Ohgaki) --089e013a114ead1745050854f63a Content-Type: text/plain; charset=UTF-8 Hi all, On Fri, Nov 21, 2014 at 10:48 AM, Marcio Almada wrote: > > Not a voter, but I don't really see the usefulness of this in core > either. > > True. This could be on packagist or a php ext, but should not be in > core. Main problem is that it carries too much ambiguity between > validation and coercion while doesn't solve the real problem: strict > typing. To be honest, I have mixed feeling for this FRC. Stricter type check is good. However, it requires runtime cost. There is an alternative solution that can achieve strict checks without runtime cost. DbC support does this. It requires user code, but developers should write code for validation with DbC anyway. With DbC support, developers can perform full parameter/return value/state checks. It may be good to have easy syntax for parameter check in precondition check block. function foo($var) { in { int: $var; } // useful code here } Something like this. Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net --089e013a114ead1745050854f63a--