Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:81637 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 22195 invoked from network); 2 Feb 2015 19:26:12 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Feb 2015 19:26:12 -0000 Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.220.171 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.220.171 mail-vc0-f171.google.com Received: from [209.85.220.171] ([209.85.220.171:50489] helo=mail-vc0-f171.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 4D/62-34915-35FCFC45 for ; Mon, 02 Feb 2015 14:26:12 -0500 Received: by mail-vc0-f171.google.com with SMTP id hq11so15250485vcb.2 for ; Mon, 02 Feb 2015 11:26:09 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=GG6z63KZsY7SuHXKYBwHTsgppi+M8qO/2dIyqb07LA8=; b=giacrFmTsbAqrP06WPIeVUfu3hgh6xr4N++65srl4/uP/3DzaCA1vkgvkYW+os3eEx iC93qFOXuL4Xy1/1wcDa+0sOUM4FuG+zYREYlF467s8u1MoPU+iN8YQJBdzwnGJqxcbP xKtg4eGo5VqBL4BcdUV+NhdevNTZmu3r6kei6qTTs8sNa0ad2j4NeftxlQAnqLjygTkc JeoJgAYpR5EiWhYiirFCJOLC/hdxQuyxzac/hGZ5XRM2sc8aW0MBF2p0TGnahGOQNDhs /fXdCe0yZMBF1Aq0ESzWjG15so8NKWxmIEYzpqIPsUulVBg/9sbpRClVItA2E+A8l/hr qcUg== X-Gm-Message-State: ALoCoQkKdya1pTGW/uN4nvt+UzD3RvMP8mgxakGLcQWXGevTgEk/SNtDkh4kd3LwUEoa7dYsY/3cOrBUALRK/8tF0xKXo12RJrg1qrgYiP/iqUUAzjkJyKi6ZemxmJzGtqjQLevmppT9mSc47fNX/EBlulfZYvyC1A== MIME-Version: 1.0 X-Received: by 10.221.2.197 with SMTP id nv5mr13518617vcb.53.1422905169092; Mon, 02 Feb 2015 11:26:09 -0800 (PST) Received: by 10.52.74.73 with HTTP; Mon, 2 Feb 2015 11:26:08 -0800 (PST) In-Reply-To: <2AABD912-C2A3-4877-8B40-8E391B2BE45F@ajf.me> References: <8DCD1B72-C81D-499E-B455-E4A042CD76E6@ajf.me> <1E54E93F-8CE1-469F-BE1F-DD2F1DF76E39@ajf.me> <5175DE01-ADC9-4A0B-8343-820C53B30054@ajf.me> <2AABD912-C2A3-4877-8B40-8E391B2BE45F@ajf.me> Date: Mon, 2 Feb 2015 23:26:08 +0400 Message-ID: To: Andrea Faulds Cc: PHP Internals List Content-Type: multipart/alternative; boundary=089e0115fd02273451050e1fed2c Subject: Re: [PHP-DEV] [RFC] Scalar Type Hints v0.2 From: dmitry@zend.com (Dmitry Stogov) --089e0115fd02273451050e1fed2c Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Mon, Feb 2, 2015 at 10:12 PM, Andrea Faulds wrote: > Hi Dmitry, > > > On 2 Feb 2015, at 18:22, Dmitry Stogov wrote: > > > > So, one of the advantages of strict type hinting is the ability to catc= h > potential errors. > > For example when we pass 67 to setBody(string $message). > > Yes, that sort of thing is easily caught by strict type checks. They=E2= =80=99re > also able to catch things that are sometimes okay for weak hints, sometim= es > not. For example, some *but not all* strings are accepted for integer and > float parameters, and some *but not all* floats are accepted for integer > parameters. Strict checks make this much simpler and not dependant on the > value: either some type is accepted, or it isn=E2=80=99t. > Agree. Strict type checks are simple and may be implemented more efficient. But in case we have to support both - weak and strict, this won't make any advantage. > > Because of that, strict types can actually be effectively analysed > ahead-of-time by static analysers, IDEs and so on, and so you can catch > some types of errors while editing your code, without even needing to run > it. This is quite a powerful feature. Nikita might have more to say on th= at. > Static analyzers can work with weak conversion rules as well. Anyway, this is not directly related to run-time semantic we discuss now. Thanks. Dmitry. > > Thanks. > -- > Andrea Faulds > http://ajf.me/ > > > > > --089e0115fd02273451050e1fed2c--