Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:83928 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 87959 invoked from network); 26 Feb 2015 21:06:24 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Feb 2015 21:06:24 -0000 Authentication-Results: pb1.pair.com smtp.mail=leverton@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=leverton@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.43 as permitted sender) X-PHP-List-Original-Sender: leverton@gmail.com X-Host-Fingerprint: 209.85.220.43 mail-pa0-f43.google.com Received: from [209.85.220.43] ([209.85.220.43:38434] helo=mail-pa0-f43.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 65/E0-32582-0DA8FE45 for ; Thu, 26 Feb 2015 16:06:24 -0500 Received: by padbj1 with SMTP id bj1so16897816pad.5 for ; Thu, 26 Feb 2015 13:06:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=/+NcM8fpTpdTiYSHoTsDxq6L/Jm3nI/5PW91GK2a4/A=; b=GkLGfH1PW330Rh3pxBSpzSQT1GOGUQF/7zcZx9Y3BmF43Z2X8CfBYy32pRFAEtLvs7 mGnRhyxMcLzwfbcob8mPBcferfd9/V8UXIY6CYLmdI7QFo7JkCqz6SoZ6kDQhY48OVoX T3Ek3fwg3BIlbJHlPyDcD89fazMVPhOmAK7JqsSyGS4d79ejtNUJYEQVnvUI1ANCcbEn jiElh68bGRKBdWznXSAknLSg6sk5RJ1a5iNEaR2W9YTGT7K54waV8cT988KtWv+5FlwT 4GL5GzZ71kaSwtpp9964Wpiv+K4eqD9mft2+8L2/vJSKdHdV5qWqAS1FiATHc1fUTG0e mVFg== MIME-Version: 1.0 X-Received: by 10.66.241.173 with SMTP id wj13mr18204468pac.71.1424984779925; Thu, 26 Feb 2015 13:06:19 -0800 (PST) Received: by 10.70.65.130 with HTTP; Thu, 26 Feb 2015 13:06:19 -0800 (PST) In-Reply-To: References: Date: Thu, 26 Feb 2015 15:06:19 -0600 Message-ID: To: Theodore Brown Cc: "internals@lists.php.net" Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] A different user perspective on scalar type declarations From: leverton@gmail.com (Matthew Leverton) On Thu, Feb 26, 2015 at 9:28 AM, Theodore Brown wrote: > I am a full-time PHP developer responsible for maintaining several large > enterprise applications, as well as a number of libraries and personal apps. > I have been following the scalar type proposals quite closely, as along with > return type declarations, scalar types have the potential to reduce errors, > simplify API documentation, and improve static code analysis. > > I am in favor of Anthony's Scalar Type Declarations RFC, for two simple reasons: > > 1. It doesn't change the behavior of existing weak types. > 2. Strict types are important in some cases. > After carefully reviewing both proposals and testing the implementations out, and switching opinions many times, I've come to the same conclusion as this. (I'm glad the define() syntax was simplified.) With more and more discussion, I feel like the coercive version is just degrading back into the same weak casts as we already have. If I can pass null or " 1 " or bool to an int, then it becomes less like a different RFC and more like the same strict types RFC but without the strict mode! To be clear, I'd actually be fine with a weak-only implementation that follows the same exact rules as the explicit casts. And I'm okay with strict-mode optionally tacked on top of that -- because it can be useful and won't get in my way. But I'm no longer in favor of any in-between coercive implementation. Not a voter, so just my 2 cents. -- Matthew Leverton