Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:83342 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 93145 invoked from network); 20 Feb 2015 18:53:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Feb 2015 18:53:09 -0000 Authentication-Results: pb1.pair.com smtp.mail=jwatzman@fb.com; spf=unknown; sender-id=unknown Authentication-Results: pb1.pair.com header.from=jwatzman@fb.com; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain fb.com does not designate 67.231.153.30 as permitted sender) X-PHP-List-Original-Sender: jwatzman@fb.com X-Host-Fingerprint: 67.231.153.30 mx0b-00082601.pphosted.com Linux 2.5 (sometimes 2.4) (4) Received: from [67.231.153.30] ([67.231.153.30:18527] helo=mx0b-00082601.pphosted.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DF/FC-14173-D7287E45 for ; Fri, 20 Feb 2015 13:52:46 -0500 Received: from pps.filterd (m0004077 [127.0.0.1]) by mx0b-00082601.pphosted.com (8.14.5/8.14.5) with SMTP id t1KImlRC011040 for ; Fri, 20 Feb 2015 10:52:43 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fb.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-id : content-transfer-encoding : mime-version; s=facebook; bh=qbqHUnQAwkhFuRJYdwF3GjtL8hp+ABF03xfRCnkgigg=; b=Q2rSky4RZpq5jqf2MBWnCYLd2Ssxgq7e5X1Qzphzj5mxMdxNSEKonUZEj+z0U76G6M4t R/phiOU+it98XPrkgBXAa6+AZcNi5Y8JvrOcsMYu9swtk5Obp0s/8uQDI7F7ejRaKW9z uAFQHAaRIuZIakicHAFS5cnwlr3AxVLEOMk= Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-00082601.pphosted.com with ESMTP id 1sp98w09at-1 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Fri, 20 Feb 2015 10:52:43 -0800 Received: from m0004077 (m0004077 [127.0.0.1]) by pps.reinject (8.14.5/8.14.5) with SMTP id t1KImj2X011015 for ; Fri, 20 Feb 2015 10:52:42 -0800 Received: from mail.thefacebook.com ([199.201.64.23]) by mx0b-00082601.pphosted.com with ESMTP id 1sp98w09aj-5 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT); Fri, 20 Feb 2015 10:52:42 -0800 Received: from PRN-MBX02-2.TheFacebook.com ([169.254.5.140]) by PRN-CHUB12.TheFacebook.com ([fe80::ddee:413f:3120:8216%12]) with mapi id 14.03.0195.001; Fri, 20 Feb 2015 10:52:40 -0800 To: Rasmus Lerdorf CC: Anthony Ferrara , Larry Garfield , "internals@lists.php.net" Thread-Topic: [PHP-DEV] Reviving scalar type hints Thread-Index: AQHQTS+tBIO40ECSRlWtzmDJWY2Lnpz6VDoAgAAOAgCAAAZLAA== Date: Fri, 20 Feb 2015 18:52:39 +0000 Message-ID: References: <20150220170854.308596800F2@frontend2.nyi.internal> <54E77D2E.60407@lerdorf.com> In-Reply-To: <54E77D2E.60407@lerdorf.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [192.168.16.4] Content-Type: text/plain; charset="us-ascii" Content-ID: <6ABD6407C0C2C84699AAD8B9BD8F2C74@fb.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.13.68,1.0.33,0.0.0000 definitions=2015-02-20_09:2015-02-20,2015-02-20,1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=fb_default_notspam policy=fb_default score=0 kscore.is_bulkscore=2.22044604925031e-16 kscore.compositescore=0 circleOfTrustscore=0 compositescore=0.993775351566512 suspectscore=0 recipient_domain_to_sender_totalscore=0 phishscore=0 bulkscore=0 kscore.is_spamscore=0 rbsscore=0.993775351566512 recipient_to_sender_totalscore=0 recipient_domain_to_sender_domain_totalscore=0 spamscore=0 recipient_to_sender_domain_totalscore=0 urlsuspectscore=0.993775351566512 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1402240000 definitions=main-1502200179 X-FB-Internal: deliver Subject: Re: [PHP-DEV] Reviving scalar type hints From: jwatzman@fb.com (Josh Watzman) On Feb 20, 2015, at 10:30 AM, Rasmus Lerdorf wrote: > On 02/20/2015 09:39 AM, Anthony Ferrara wrote: >> I think if anything, the appearance of Hack (and its adoption) show >> that people want static typing, at least to some level... >=20 > To be perfectly transparent here though, you should mention that your > proposed RFC goes well beyond the strict typing that is in Hack because > in Hack the internal API is largely untyped while your proposal is to > default the entire internal API to strict types in strict mode. Also, in > Hack there is a distinction between the off-line hh_client type-checker > and the runtime. This distinction is going away pretty soon. The typechecker is an integral = part of Hack, and you shouldn't be able to ignore its errors. The runtime w= ill soon consider them fatal errors too. If your code doesn't pass the hh_c= lient typechecker, then its behavior when run on HHVM is completely undefin= ed. > Hack examples all using =20 > echo number_format('1000'); > echo htmlspecialchars(1000); > echo md5(1000); >=20 > These are all fine both as far as the type-checker is concerned as well > as the runtime, of course, but they are runtime fatals in your proposed R= FC.\ And they should be errors in Hack too. The reason they aren't are to ease t= ransitions from PHP to Hack. I'd expect them to be more strongly typed even= tually. > And if you only go by the runtime and ignore the out-of-band type > checker there are almost no strictness rules applied to the internal API > in Hack. >=20 > eg. explode(0, 1000); >=20 > Here the hh_client type checker will complain that it is expecting > strings, but the runtime will run it nicely. >=20 > So when you say, and as I have heard other people say, that people want > Hack-like strict typing, you have to be a bit careful about what is > meant by that. Even in the cases where the internal API is typed in > Hack, it is still not a runtime fatal if they are called with the wrong > types. See above -- relying on (or even really thinking about) this distinction is= relying on implementation details which are going to change. Josh