Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:95500 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 27907 invoked from network); 29 Aug 2016 13:36:21 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Aug 2016 13:36:21 -0000 Authentication-Results: pb1.pair.com smtp.mail=igor.inas@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=igor.inas@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.49 as permitted sender) X-PHP-List-Original-Sender: igor.inas@gmail.com X-Host-Fingerprint: 209.85.214.49 mail-it0-f49.google.com Received: from [209.85.214.49] ([209.85.214.49:35581] helo=mail-it0-f49.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 73/E8-34481-45A34C75 for ; Mon, 29 Aug 2016 09:36:20 -0400 Received: by mail-it0-f49.google.com with SMTP id x131so102931488ite.0 for ; Mon, 29 Aug 2016 06:36:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to; bh=ZUCxpu6vmIbi5Jyt8TjVkV3Gvm+asso+lOjmGFFR094=; b=keaoQFxywIURynTHQFHCqwnsYD/0a5uVEvOrDzQ0TKKiw8dPvMc7dTIEEROUZDiIoq SHPTHJ8ZzAmpeObkqmi4RzUpMLQNHNk0RyHdAJwsE4YUoFbx4QmW01IQ5m3a7iVOv98i lP6Ef49HM8Zsi+X0JPLEj6R9GhCEIud4PGUKEhWO1kPHM7qBWHaPVyC0fs4RMz1cNG2I Z+1VSChX2ZaCTNx3sCid8JDZxAbnhejrfKgH18bmn/hYYUFIjwotrgaGbFMSWSBAlF6k M4vRCHcp6BCusLORRW2JBmTvoDYompU+YC2SLOqdxvF9jqL3b+KHrtBQocyXp9XD1BLo 1SDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=ZUCxpu6vmIbi5Jyt8TjVkV3Gvm+asso+lOjmGFFR094=; b=kxMOLhGGTT8AlyqF3x77nEEnEAPZoAYUMjBn/1qCSoV/yFaJ9AFPtPSdgM7e0frr4O zzGhqw9OR6fAq9ORPXTfBkajvuRfro48UcuJD7xFD2FUwe1Jox2ebhUSgXQJ6o/7LhLy 0zMgXmFvJE67Zca57Sk0yWh7WJFeQoWWaHy67wE2ro/WejpnQpKE3d7JTJaGCEeEctWL +SZHt72soRtQC8ZC55iuVf7U89+pa/89V1cWmchoISpYsWRT/zVHWXD0rXZNZ0mluqkF rcz9hdl0QRReCTp9ejeU6GRwk1n+US4EdN1ac8uXVxuye7JH8JSmppiD03Vd0mtsZCaG BwOQ== X-Gm-Message-State: AE9vXwNskoUTxVdJpviVjky4+njTDMt21nomMwMdmb76yhqQBPOE/KhAPbMAs7G15uVEhxgb7C9IYOZmj2iF/A== X-Received: by 10.36.92.196 with SMTP id q187mr16184029itb.33.1472477776744; Mon, 29 Aug 2016 06:36:16 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.133.14 with HTTP; Mon, 29 Aug 2016 06:36:16 -0700 (PDT) Date: Mon, 29 Aug 2016 15:36:16 +0200 Message-ID: To: internals@lists.php.net Content-Type: multipart/alternative; boundary=001a114457b4d29bfb053b35f205 Subject: Nullable types before union types From: igor.inas@gmail.com (Igor Inas) --001a114457b4d29bfb053b35f205 Content-Type: text/plain; charset=UTF-8 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 --001a114457b4d29bfb053b35f205--