Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:81759 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 17055 invoked from network); 4 Feb 2015 05:25:03 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Feb 2015 05:25:03 -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.170 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.220.170 mail-vc0-f170.google.com Received: from [209.85.220.170] ([209.85.220.170:63776] helo=mail-vc0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A7/D1-20608-E2DA1D45 for ; Wed, 04 Feb 2015 00:25:02 -0500 Received: by mail-vc0-f170.google.com with SMTP id kv7so18427512vcb.1 for ; Tue, 03 Feb 2015 21:24:59 -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=UoR1iRV4ktGvQPSGgOb4vBTQb6N5oKyVriYap3UO6Bo=; b=SxbeYk6POZ0MG498posjHD717+KVHoTUVBDLa2rm2ySLvFA5AjRxYns+ZN68zbCnRh 7SpYb2NLGwHujGFrnZYZKUeR0EtLD6v4tyZMN6TeQWeNaHsMecmsDHSX5cjpYw1bL6EI t9r9L7VmVRCFhybPZ9d6tD/lNp5CJi/jqPlxv0HzYuSCk+zJy4taqeem22p6x01LZ7Fg rt9gll6QDU8G2obli3zvo2O1gwesZGIDH4wHUw48+OibjyIa4j+Y4tcWhR/T22PI01zO xA5QhdMtyenSrvgd/S6fL0gHyFJvhdmTR9eDN3YUACeKZ1pr4t+PLQQi/q9JF626hcl/ wjWw== X-Gm-Message-State: ALoCoQki2ngZwITuC/Z55L//UA+SfJxyCZjlDASdWPx2BU9/bD/Nz/v6iXQ8Il9BPZ/7m64CUmV+yeELy2bmR6WEKDhss7KX/lNsRFxI+2WrMAAT28bpFh9Fi/o9IGmjrAMxyoZlvhVDweBaa4ZBo8BZJbtwpLT0UA== MIME-Version: 1.0 X-Received: by 10.221.18.136 with SMTP id qg8mr18712053vcb.27.1423027499589; Tue, 03 Feb 2015 21:24:59 -0800 (PST) Received: by 10.52.74.73 with HTTP; Tue, 3 Feb 2015 21:24:59 -0800 (PST) In-Reply-To: <5E952833-7651-40A5-B88C-1701B100F150@ajf.me> References: <5E952833-7651-40A5-B88C-1701B100F150@ajf.me> Date: Wed, 4 Feb 2015 09:24:59 +0400 Message-ID: To: Andrea Faulds Cc: Arvids Godjuks , PHP Internals , Nikita Popov Content-Type: multipart/alternative; boundary=001a113399e69e7b9c050e3c688b Subject: Re: [PHP-DEV] What do we need strict scalar type hints for? From: dmitry@zend.com (Dmitry Stogov) --001a113399e69e7b9c050e3c688b Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Tue, Feb 3, 2015 at 7:14 PM, Andrea Faulds wrote: > Hi Dmitry, > > > On 3 Feb 2015, at 04:07, Dmitry Stogov wrote: > > > > I have similar opinion. Strict typing looks foreign for PHP. > > It is in a way, yes. PHP has traditionally been =E2=80=9Cweakly-typed=E2= =80=9D everywhere. > > That being said, we=E2=80=99re not always weakly-typed (there are strict = type > checks in some places), and userland code has sometimes done strict type > checks anyway. > > > I see, strict type hints may be useful. > > Aspecially for testing and error detection, but anyaway, I'm not sure i= f > and how it should be enabled. Declare() is a working solution, but it's n= ot > excelent. > > It=E2=80=99s not a perfect solution, but I haven=E2=80=99t seen anything = that seems to be > much better. The best bit about declare() is that it would make strict > types completely optional, so people who don=E2=80=99t like them wouldn= =E2=80=99t have to > use them, even if they call code which does. > I agree. It's probably the best solution that we saw. But it's still not good enough, It would be great to make the obvious part of the proposal accepted first. I would suggest to make two separate voting questions. 1) Enable scalar type hinting with standard rules. 2) In addition enable strict type hinting triggered by declare(). Thanks. Dmitry. > > -- > Andrea Faulds > http://ajf.me/ > > > > > --001a113399e69e7b9c050e3c688b--