Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:92807 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 16588 invoked from network); 26 Apr 2016 17:26:11 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Apr 2016 17:26:11 -0000 Authentication-Results: pb1.pair.com header.from=morrison.levi@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=morrison.levi@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.192.195 as permitted sender) X-PHP-List-Original-Sender: morrison.levi@gmail.com X-Host-Fingerprint: 209.85.192.195 mail-pf0-f195.google.com Received: from [209.85.192.195] ([209.85.192.195:34073] helo=mail-pf0-f195.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3D/36-20013-0B4AF175 for ; Tue, 26 Apr 2016 13:26:10 -0400 Received: by mail-pf0-f195.google.com with SMTP id 145so2098434pfz.1 for ; Tue, 26 Apr 2016 10:26:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=J+MI246k8/MLSaqSPzOxSZAz9U5AAWRYW15zBzFjl5w=; b=NTYnVy3hlg6KdzDhIwA/UKn91Wbg5r2ek6/2VqL+elwKluPd+CgFemTla23vZEJBX8 jbvdLnM3M72jdUYLcDhjDAvvAIU3Jf6Pe/86VbxTf5GUS173JRgAFdZHSucSUQ+5+Qds RKS/193mtRmwrLOG8Kpl5Jz5YzB0agHmSiAYCqCeWXUP8oipAnVhyKTliKwrRexioc26 60nvZyk+tIVqjImS1L3gUlTmumiy0FBrx/kIz+PU9OfIML8/1jx34Do3Hfj0JGqJv85t 6qrJ1GmyRAWBOA3Actucw2q4hNYvOU7jsSLw4UYIi2a4WSOSm7HiKxnkVIHiGIusACHT FlGw== 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; bh=J+MI246k8/MLSaqSPzOxSZAz9U5AAWRYW15zBzFjl5w=; b=cE4rulZTJloEc/N3/VdD2sZQ+hT5AJFS8OrLcBH/m7XrOKciUPYdtMGFEp8Rab7/Wg jxjmEsAtn6jO+S6zMywEECgGc4OKeHEEGsnxmH14DyTLauEH0FhQ2b/+XV3Ql7vEBWCn TVOjVCT0fORj2gzYamTWNoq5ufUk+4xRqKM8VqIpvagzVrbXtDklfOEsSoXT3l+o/rwr nnPcssfjqEST1tvAQh+Lip8/jc2Q2Cj75Lkw+hCes2r1YXB7citGiKP0Z8bub5AhxdcN PgC1yXCEBsVXxHt+M7vJn4dDHWwj8XpCZ8UnfhuRh2ttxBVW/++qcFWbJwfn6x6NiPYC 07fw== X-Gm-Message-State: AOPr4FU+/BdQqmKMKs+IFIspg684zsz12oPJBufvis6rfwxWsbiWjCYoIVQZBFqajj2YN6hMCmzxTuk98Wv6+Q== MIME-Version: 1.0 X-Received: by 10.98.98.131 with SMTP id w125mr5341246pfb.112.1461691565974; Tue, 26 Apr 2016 10:26:05 -0700 (PDT) Received: by 10.66.132.79 with HTTP; Tue, 26 Apr 2016 10:26:05 -0700 (PDT) In-Reply-To: References: <571F7B91.2030102@zend.com> Date: Tue, 26 Apr 2016 11:26:05 -0600 Message-ID: To: Niklas Keller Cc: Bob Weinand , Dmitry Stogov , internals , Joe Watkins Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] [RFC] Patch for Union and Intersection Types From: morrison.levi@gmail.com (Levi Morrison) On Tue, Apr 26, 2016 at 11:20 AM, Levi Morrison wrote: > On Tue, Apr 26, 2016 at 11:00 AM, Niklas Keller wrote: >> 2016-04-26 16:58 GMT+02:00 Bob Weinand : >>> >>> Yeah, I'd like to not allow ?Foo in any case if union types pass. >> >> >> What's the reason for that? To me, null is neither a type nor should it be. > > On the contrary, our manual says: > >> NULL is the only possible value of type null. > > And internally it is also a distinct type. > > It's been this way for a long time; we just haven't permitted `null` > as a type declaration because until now it has been useless. To further expand on why it was previously useless: function foo(Null $a) { return $a; } There is only one possibility for this parameter, which is the value `NULL`. There is hardly any value to it when you can just write this instead: function foo() { return NULL; } In words: if the only possible value for a parameter is null then it's not really a parameter; it's just a constant value and doesn't need to be parameterized.