Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:84864 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 54325 invoked from network); 15 Mar 2015 18:16:55 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Mar 2015 18:16:55 -0000 Authentication-Results: pb1.pair.com header.from=me@kelunik.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=me@kelunik.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain kelunik.com from 81.169.146.216 cause and error) X-PHP-List-Original-Sender: me@kelunik.com X-Host-Fingerprint: 81.169.146.216 mo4-p00-ob.smtp.rzone.de Received: from [81.169.146.216] ([81.169.146.216:42765] helo=mo4-p00-ob.smtp.rzone.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BD/B6-29489-59CC5055 for ; Sun, 15 Mar 2015 13:16:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1426443410; l=1794; s=domk; d=kelunik.com; h=Content-Transfer-Encoding:Content-Type:Cc:To:From:Subject:Date: References:In-Reply-To:MIME-Version; bh=BvCGgWlYHTrOc4wDCPKuoU3PPllGs6UP9nX+l76u9U8=; b=werCOMN5/fM51uFIREAQq9+LfQVQdp4j3X9uzc7pUUjBHAvxDI8EprTRoO8qqlIs7Z1 DKwAOBh/jfJahsja4bdVLaUeDJMvZRnZ99RmZfGwdUxgDsAu2oMnNsAEFpjGjQvEy/2gd NWXF7MtQomIDnbZ6hnLnffKpgbRMDWKfqV0= X-RZG-AUTH: :IWkkfkWkbvHsXQGmRYmUo9mls2vWuiu+7SLGvomb4bl9EfHtOnE6 X-RZG-CLASS-ID: mo00 Received: from mail-wg0-f52.google.com ([74.125.82.52]) by smtp.strato.de (RZmta 37.4 AUTH) with ESMTPSA id n0318er2FIGoOO4 (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) for ; Sun, 15 Mar 2015 19:16:50 +0100 (CET) Received: by wggv3 with SMTP id v3so23676166wgg.1 for ; Sun, 15 Mar 2015 11:16:50 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.180.93.5 with SMTP id cq5mr5503073wib.18.1426443410386; Sun, 15 Mar 2015 11:16:50 -0700 (PDT) Received: by 10.27.222.1 with HTTP; Sun, 15 Mar 2015 11:16:50 -0700 (PDT) In-Reply-To: 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> Date: Sun, 15 Mar 2015 19:16:50 +0100 Message-ID: To: Levi Morrison Cc: Bob Weinand , Anthony Ferrara , Zeev Suraski , Stelian Mocanita , PHP internals Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [RFC] Basic Scalar Types From: me@kelunik.com (Niklas Keller) 2015-03-15 19:13 GMT+01:00 Levi Morrison : > On Sun, Mar 15, 2015 at 12:03 PM, Bob Weinand wrote= : >>> Am 15.03.2015 um 18:48 schrieb Anthony Ferrara : >>> >>> Andrea's RFC had the following wording: >>> >>>> The only exception to this is the handling of NULL: in order to be con= sistent with our existing type hints for classes, callables and arrays, NUL= L is not accepted by default, unless the parameter is explicitly given a de= fault value of NULL. This would work well with the draft Declaring Nullable= Types RFC. >>> >>> This proposal has a different behavior here. It explicitly allows >>> nulls for types: >>> >>> function foo(int $abc) { var_dump($abc); } >>> >>> Unlike my proposal and any of Andrea's, calling foo(null) will be >>> int(0) instead of an error. >>> >>> This is an important distinction as it basically undermines any >>> attempt at a nullable RFC, since it makes primitives implicitly >>> nullable. >>> >>> 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 si= gnature. > > I think allowing `null` for an `int` is an error. Converting a null to > zero on a type boundary is harmful in my opinion. I agree, `null` shouldn't be allowed for `int`. > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php >