Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:92759 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 7506 invoked from network); 25 Apr 2016 23:37:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Apr 2016 23:37:09 -0000 Authentication-Results: pb1.pair.com smtp.mail=morrison.levi@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=morrison.levi@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.192.194 as permitted sender) X-PHP-List-Original-Sender: morrison.levi@gmail.com X-Host-Fingerprint: 209.85.192.194 mail-pf0-f194.google.com Received: from [209.85.192.194] ([209.85.192.194:33606] helo=mail-pf0-f194.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7A/17-02401-42AAE175 for ; Mon, 25 Apr 2016 19:37:08 -0400 Received: by mail-pf0-f194.google.com with SMTP id e190so18870754pfe.0 for ; Mon, 25 Apr 2016 16:37:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to; bh=ExyzcFUb4HsKYnanc3vlvrqKqjD6PdJ1aS7DQ7XVRuU=; b=vnhMR+4MVig/5YTYJjGIvyLfTpie0yHcu97uWC9PW5EyqZ33doqeTi6Ls6v0N3QyE6 g/St0UC/9TjKlVVyqTyQ62OdBut4CG2NkqQO9qIw+JzzRhbOCmiImDZ4dNRiMY+qNZpu J0DaGcVfSPZgZpcbi03UdOZcAEaF0rr/FQyO0HJIrTayw/R/3p8iXzEBwHrXop1vSXXg pB5XNbkC6kJzSB4rjI/Ta4JcFhNVXwvPwzcR2gtezW+HMBBX94uYXnIoQnUTCLaX3u/K uRtZLpCL+XG8ruP5hfqqtWIx+3C71Ix2MK30QSwlCe1OMNNV5LUzyKKbgjUbIG3xpxX5 M09w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to; bh=ExyzcFUb4HsKYnanc3vlvrqKqjD6PdJ1aS7DQ7XVRuU=; b=LvwCF7mZIZFibxjNuKlU+imM1FcEHQQI7A7FpnXFTFaYqf62Fb7orHwnt3NYoRCy7l /yVWhFE+dFH0V5KOTH3Iu84EK0jZLtz1BqVgv2oh3vY4t8eY/IK4aKntBRhGYc1NT4O8 tgpprLzR3JULPNplPMLMMzqaDbv1LoqTYdUgJeYQ2umAF+JVQA2CM8f72CLYfgW9BBL7 I664Mrs+LG7MFYPNlxM+pCq+kjieRLU5BMeSpIcrsxRjUYj93ZQgawevcpB6aL4bBLnR sh37SRqniT7hHYKYrQTfeGx8mJ6SkhFIHt7vPJ3QbnrycQdZKBoGAW0PlXHCMe2Fzha9 d4DQ== X-Gm-Message-State: AOPr4FVHe3D40AH6ZKqBaBdQ07Yla1xOsgq9vtI1wjX+mLO7jCfUsXmO2TvVm6FosjIzPxWp/XtBVSBIFiD/DQ== MIME-Version: 1.0 X-Received: by 10.98.98.131 with SMTP id w125mr809292pfb.112.1461627425543; Mon, 25 Apr 2016 16:37:05 -0700 (PDT) Received: by 10.66.132.79 with HTTP; Mon, 25 Apr 2016 16:37:05 -0700 (PDT) Date: Mon, 25 Apr 2016 17:37:05 -0600 Message-ID: To: internals Content-Type: text/plain; charset=UTF-8 Subject: [RFC] Patch for Union and Intersection Types From: morrison.levi@gmail.com (Levi Morrison) Internals, Joe Watkins and Bob Weinand have worked out a [proof-of-concept patch for union types][1]. Please go download it and experiment with it. A few things to note: * This patch includes intersection types. However, a type expression must be either a union type or an intersection type; it doesn't support both such as `Array | (Countable & Traversable)`. * This patch adds `null`, `true` and `false` for type declarations. * This patch includes conversion rules for weak types. * It does not have short-hand for unions with null (`?Foo` being `Foo | Null`) These features (or omitted ones) are not necessarily what will be voted on. Rather this patch allows us to experiment with these features in code. This experience should be helpful for us to solidify how we actually feel about these features. I especially would like people to try out the conversion rules for scalar types as it has been a point of discussion. [1]: https://github.com/php/php-src/pull/1887