Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:95503 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 34959 invoked from network); 29 Aug 2016 14:17:54 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Aug 2016 14:17:54 -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.161.175 as permitted sender) X-PHP-List-Original-Sender: morrison.levi@gmail.com X-Host-Fingerprint: 209.85.161.175 mail-yw0-f175.google.com Received: from [209.85.161.175] ([209.85.161.175:33557] helo=mail-yw0-f175.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A8/4A-34481-01444C75 for ; Mon, 29 Aug 2016 10:17:54 -0400 Received: by mail-yw0-f175.google.com with SMTP id r9so86559046ywg.0 for ; Mon, 29 Aug 2016 07:17:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=nNDSkIRJq2aU0WsCvMBsIH2+WMgDjXOlW4Y6fjiiFo0=; b=hP94NYdALcwOpY7dgZJr02zUTLP68eCN0hsvg9xd6DPZai/HlnXbeXja5RnPbdB1dM Uj/D2q64txblNl8bwZ3JEJegwGkiom8YOqB6PkpHUVs9o6Gd6hMrpBzpcOi3mHNl1oi3 loo84TAx/Ck/2C2Z2aZZInmLNR1WPRdwRznSlxIYBWixFUt1EssJn6nZpOzYZXGWaBS1 LeKDdPUV87c6j3CKu8iZ+VDzUovKcufwn2GwwrGlN17mZiRZIlEzbSYlf4yixaIWAKHi QdFebu/Zj3FoIEtiFK87jlJNzukWw13Lpa24lwIWudBFBHTbc5kkCxbjP6FW8IqG0Ahn +Mtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=nNDSkIRJq2aU0WsCvMBsIH2+WMgDjXOlW4Y6fjiiFo0=; b=F5VjyAEGbMZ5Hl9O2cr2F/mmLRC4gIDa+rRFwVuhD8LbCt7ml81BS9Xuus4ktSNWrX Wwtv+cNKB93WT00R1nd77REl5bjHH5WAXP+fcfEZcTSoBHBUf9vEYnWtEjlbRYdZ6mEo J7pRTga/OjhJtONjUqVZq5k5Q3AYqBPeRfsNFTIBW85ciZohjWKDj9wMFdHsePI7gzge joMRbXWyCH8Q3+2a8dvFy6kd7FmwI+0bbhDkvmwc19Vevxp7H4GdGNshiB9fubuHr7vt tcnLOuUTLUNpALJ/c22ArWqfnkMDnYkJUuFpXgF9xE737Q73WMFNoLwMXDssxXm+VlIw cEKA== X-Gm-Message-State: AE9vXwNLQ9S8av1jP1a49M+1QACAKRtybf7ms689cM8F1loIIi1Dza8OJKRd3dlFXiaEGeP9N1Q42Jb1NMm8Yg== X-Received: by 10.129.159.131 with SMTP id w125mr15646340ywg.168.1472480270381; Mon, 29 Aug 2016 07:17:50 -0700 (PDT) MIME-Version: 1.0 Sender: morrison.levi@gmail.com Received: by 10.13.193.66 with HTTP; Mon, 29 Aug 2016 07:17:50 -0700 (PDT) In-Reply-To: References: Date: Mon, 29 Aug 2016 08:17:50 -0600 X-Google-Sender-Auth: Bp26Zxm3pOayAtewmQRilIpJHK4 Message-ID: To: Igor Inas Cc: internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] Nullable types before union types From: levim@php.net (Levi Morrison) On Mon, Aug 29, 2016 at 7:36 AM, Igor Inas wrote: > Hello, > > same as last post in the mailing list - this may have been suggested before > - but I had hard time finding it in the archives. > > Coming from static typed languages, I love the addition of return type > annotations and extension of parameter type annotations. I also love the > fact, that types are not nullable by default. > > I am reading about the proposal to add nullable types before union types > are fully implemented. This would be done by utilizing question mark (int? > / ?int). > > My question is: would it be too difficult to implement nullable types using > syntax of union types, but semantically, only max two types would be > allowed in the union and one of them would have to be null. So only allowed > forms would be: > - int | null > - null | int > > I am thinking about the future, when union types become implemented and > suddenly there would be two ways how to annotate the same nullable type: > - int | null > - int? > > Thanks for more insights, > Regards, > Igor The union types RFC did not get enough support to pass. Additionally having two forms of syntax to do the same thing is not the worst thing that can happen in language design. They would at least be semantically equivalent which is the important thing.