Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:84861 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 49265 invoked from network); 15 Mar 2015 18:03:56 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Mar 2015 18:03:56 -0000 Authentication-Results: pb1.pair.com smtp.mail=bobwei9@hotmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=bobwei9@hotmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain hotmail.com designates 65.55.111.77 as permitted sender) X-PHP-List-Original-Sender: bobwei9@hotmail.com X-Host-Fingerprint: 65.55.111.77 blu004-omc2s2.hotmail.com Received: from [65.55.111.77] ([65.55.111.77:52385] helo=BLU004-OMC2S2.hotmail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D6/B5-29489-B89C5055 for ; Sun, 15 Mar 2015 13:03:56 -0500 Received: from BLU436-SMTP51 ([65.55.111.71]) by BLU004-OMC2S2.hotmail.com over TLS secured channel with Microsoft SMTPSVC(7.5.7601.22751); Sun, 15 Mar 2015 11:03:53 -0700 X-TMN: [QW4bxnZlL++NSL+MSBcDXdmcXQyal43v] X-Originating-Email: [bobwei9@hotmail.com] Message-ID: Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 (Mac OS X Mail 8.2 \(2070.6\)) In-Reply-To: Date: Sun, 15 Mar 2015 19:03:47 +0100 CC: Zeev Suraski , Stelian Mocanita , PHP internals Content-Transfer-Encoding: quoted-printable References: <325E0097-FD7E-4997-A95D-20C62368E162@zend.com> <55031C54.6060802@eliw.com> <7CE491F0-C243-4788-ADA2-5DA9DF1D1168@php.net> <332304ae552bfc635f999a8d73b505f0@mail.gmail.com> <85d81405ee1791efadea83cf734ebce3@mail.gmail.com> To: Anthony Ferrara X-Mailer: Apple Mail (2.2070.6) X-OriginalArrivalTime: 15 Mar 2015 18:03:50.0723 (UTC) FILETIME=[64361930:01D05F4A] Subject: Re: [PHP-DEV] [RFC] Basic Scalar Types From: bobwei9@hotmail.com (Bob Weinand) > Am 15.03.2015 um 18:48 schrieb Anthony Ferrara : >=20 > Andrea's RFC had the following wording: >=20 >> The only exception to this is the handling of NULL: in order to be = consistent with our existing type hints for classes, callables and = arrays, NULL is not accepted by default, unless the parameter is = explicitly given a default value of NULL. This would work well with the = draft Declaring Nullable Types RFC. >=20 > This proposal has a different behavior here. It explicitly allows > nulls for types: >=20 > function foo(int $abc) { var_dump($abc); } >=20 > Unlike my proposal and any of Andrea's, calling foo(null) will be > int(0) instead of an error. >=20 > This is an important distinction as it basically undermines any > attempt at a nullable RFC, since it makes primitives implicitly > nullable. >=20 > Anthony. Anthony, I think you've got something wrong there. It won't undermine an attempt = at a nullable RFC. In the weak scalar typing world, nullables won't change what we accept, = but what we receive. function (int|null $abc) { var_dump($abc); } (or ?int or whatever syntax we will use) would allow null to *not* be casted here. Means foo(null) will lead to $abc being null and not int(0) with that = signature. Bob=