Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:95504 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 36644 invoked from network); 29 Aug 2016 14:21:35 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Aug 2016 14:21:35 -0000 Authentication-Results: pb1.pair.com smtp.mail=bjorn.x.larsson@telia.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=bjorn.x.larsson@telia.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain telia.com from 81.236.60.154 cause and error) X-PHP-List-Original-Sender: bjorn.x.larsson@telia.com X-Host-Fingerprint: 81.236.60.154 v-smtpout1.han.skanova.net Received: from [81.236.60.154] ([81.236.60.154:50292] helo=v-smtpout1.han.skanova.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B9/AA-34481-AE444C75 for ; Mon, 29 Aug 2016 10:21:33 -0400 Received: from [192.168.8.8] ([94.254.95.82]) by cmsmtp with SMTP id eNRHbjrElCjZEeNRHbBn0r; Mon, 29 Aug 2016 16:21:27 +0200 To: Igor Inas References: Cc: PHP internals Message-ID: <4705db52-c97b-6b16-aeb2-48fc7adb24a6@telia.com> Date: Mon, 29 Aug 2016 16:21:33 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-CMAE-Envelope: MS4wfEMObWcej26UFOK6H289Ml/MtpA/91cXVArtlGIm0O8tYrXnEieFOIfO7wIbLz//Y8vVI2CKCuYQRpOAJSZCcf1zLuGVGjMh7K7D1egxc+q9tQRkI2o9 RroOKFzo3f6j7SaWzyfVPKT6iDvS8hJPJ6Ionc4XNWrGNDkyQr3BL+u6XY0TCceGX1JkQA95KmXDtxgbnxtXwvKqiKKxaqnGIw0= Subject: Re: [PHP-DEV] Nullable types before union types From: bjorn.x.larsson@telia.com (=?UTF-8?Q?Bj=c3=b6rn_Larsson?=) I think you will find information about this in the threads for discussion and voting regarding Nullable types RFC: - https://marc.info/?l=php-internals&m=146060540111128 - https://marc.info/?l=php-internals&m=146289381815830 - https://wiki.php.net/rfc/nullable_types Regards //Björn Larsson Den 2016-08-29 kl. 15:36, skrev Igor Inas: > 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 >