Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:93112 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 11103 invoked from network); 8 May 2016 14:33:18 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 May 2016 14:33:18 -0000 Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.161.179 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.161.179 mail-yw0-f179.google.com Received: from [209.85.161.179] ([209.85.161.179:36716] helo=mail-yw0-f179.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id EE/A0-04420-D2E4F275 for ; Sun, 08 May 2016 10:33:17 -0400 Received: by mail-yw0-f179.google.com with SMTP id o66so263395160ywc.3 for ; Sun, 08 May 2016 07:33:17 -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=xnrDlfDQSGtSYtZIIWZmfp//jeyDeYSH4BSm9HP2n7Y=; b=gQdx4q03kleStdHHLKf7ur5z6T/yzo7leMcz1Jo+w7npNzEYVDt9iLzKoUJ7a7MQRc irQSy9vD/0MkvqyJTulhfL8JZWQOne4QnTrBBl/SIQznZUHRIq6vF9QcotK7QwrvxTSE rwRlEUYAIgmlzU5ZyK9UHjzt+4ezf9hCU06GSoS1ODREMl7SZybIVFJuw5Fcblax2Zk4 PSp8fDVnImWO6t55jgIPM98Age2dpS/sK+tQGnBQ+eWC88KZbsIerxp5QP8+xR4R3AXN 0KkwJOyjgZkEScCmrevZ50QIxh23Scj7HyPFC5yuOLo5KK0W9gfUPFAyJkEPRXwbys3K FBRw== 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=xnrDlfDQSGtSYtZIIWZmfp//jeyDeYSH4BSm9HP2n7Y=; b=UZV7yRz07D2nRSKUxDVusV1n5QrwGTkHNfmh2xDbTLVpDj4HEDmlpfjZ+Fq5gyKKS5 PcuVlnn1OL2HlWx9f2s3+kth8qHNYMGJ7x+SHbgBiWGQoO4oH4d+y+ZmQrOjUj2JRFox Nw0fODVP9PZWstB2w9jRdSXgi9wnvZXtDIe/n1KF+EHye2jgr5eYFOFdKKDiWmYqBA+0 glHtvMPo8IE4RvKiQFkvnaM/kSAKIiiB6gUrTzrEErDaJef1LxiZhSFjbFQm21vleP/F DF5L+Ml/ofsRHIg1fRHRb47Z+HrvrbawOCO0j7+qCTEH1lWEMKYftNz/etpfZqfUrimH F/eg== X-Gm-Message-State: AOPr4FUUejootfOttSGzLmlP6oFLf5i7CM+GdR6ZsMfihI5Jf7t0J/EqkKzIqUkjLqoitSEuEZK22pHSbvq0rg== MIME-Version: 1.0 X-Received: by 10.37.37.132 with SMTP id l126mr14803897ybl.61.1462717993952; Sun, 08 May 2016 07:33:13 -0700 (PDT) Received: by 10.13.239.3 with HTTP; Sun, 8 May 2016 07:33:13 -0700 (PDT) In-Reply-To: References: <572E0A60.4090506@thefsb.org> Date: Sun, 8 May 2016 16:33:13 +0200 Message-ID: To: Tom Worster Cc: Levi Morrison , internals , Dmitry Stogov Content-Type: multipart/alternative; boundary=001a113d40026faa4105325592d2 Subject: Re: [PHP-DEV] Re: [RFC] Pre-vote notice for Nullable Types From: nikita.ppv@gmail.com (Nikita Popov) --001a113d40026faa4105325592d2 Content-Type: text/plain; charset=UTF-8 On Sun, May 8, 2016 at 3:54 PM, Tom Worster wrote: > On 5/7/16, 1:19 PM, "Nikita Popov" wrote: > > >This RFC has one primary vote and one secondary vote. The primary vote > >determines whether we want to add nullable types to our type system. The > >secondary vote decides how precisely this will happen, in this instance > >deciding whether nullable types will be restricted to return types only > >or not. This is a standard voting layout, with precedent in a number of > >other RFCs. > > > >The reason why the second vote must use a 1/2 majority is symmetry. You, > >as somebody who does not like nullable parameter types, argue from a > >perspective of one 2/3 majority RFC for introducing nullable returns and > >another 2/3 majority RFC for introducing nullable params. I, as somebody > >who thinks supporting this syntax only for returns is wildly > >inconsistent, will argue from a perspective of a 2/3 majority RFC for > >introducing nullable *types* and another 2/3 majority RFC for restricting > >them to return types only. Depending on the perspective this would > >require either a 2/3 majority, or a 1/3 "majority" for unrestricted > >nullable types. Using a 1/2 majority vote ensures that there is no bias > >for either choice. > > The explanation is very clear. Thank you. > > Tom > > > (Btw, I don't disagree about the inconsistency you mentioned. But I don't > think it's a wild inconsistency, rather a justified one, given our > context.) > At this point in time, with the current state of our type system, I agree that this is not a wild inconsistency. However, the type system is expanding. Typed properties are already under discussion, and they would certainly support nullable types (in fact, the proposal is currently blocked by us not having them yet). Generics are also already under discussion (though far removed from a viable implementation). They would, presumably, also support nullable types as generic type parameters (or at least I don't see why not). Following this trend, we'd end up in a situation where nullable types are supported *everywhere* -- apart from parameters. Which is in my eyes a pretty bad spot to be in. At that point we'd have gone from this being a "nullable return types" feature to a "nullable types, but not allowed in parameters" feature, which is just weird. Example for nullable types used in all of return types, parameter types and property types. class Node { private ?Node $left; private ?Node $right; private $value; public function __construct(?Node $left, ?Node $right, $value) { $this->left = $left; $this->right = $right; $this->value = $value; } public function getLeft() : ?Node { return $this->left; } public function getRight() : ?Node { return $this->right; } public function setLeft(?Node $node) { $this->left = $node; } public function setRight(?Node $node) { $this->right = $node; } // ... } Not having nullable types in parameters here would require you to either drop the type altogether, or allow $node->setLeft() (eeeek), or differentiate between $node->setLeft($nonNullNode) and $node->unsetLeft(), which tends to be ugly for use in algorithmic transformations. Regards, Nikita --001a113d40026faa4105325592d2--