Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113942 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 99522 invoked from network); 3 Apr 2021 20:43:01 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 3 Apr 2021 20:43:01 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 2DD691804DB for ; Sat, 3 Apr 2021 13:41:20 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00,BODY_8BITS, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, FREEMAIL_REPLYTO,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-40130.protonmail.ch (mail-40130.protonmail.ch [185.70.40.130]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sat, 3 Apr 2021 13:41:18 -0700 (PDT) Date: Sat, 03 Apr 2021 20:41:09 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail; t=1617482476; bh=iCUKAfDJBsEc0rIT7VKWv0y63BEtEzQCtQUxE5tqIdc=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=ep73t/dPT0dLdXjtQp2zs/FrSebK4+teAOK4+fM57I/CU1fpXkH7AsI4n4JnKtgSP 1Ab8m/BTfhcLABExQQe03dWkT6LIReOIXBEWPWSHJut2cyCzQsSY0Df4sKhcvKb7Hz Ac/NrvR4RqmoA/bOEWTeqoMUCMNpphDsi+ueJXqg= To: "G. P. B." Cc: Matthew Brown , PHP internals Reply-To: Saif Eddin Gmati Message-ID: In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [RFC] Pure intersection types From: azjezz@protonmail.com (Saif Eddin Gmati) Personally, I am against the syntax used in the PR for composite types( even tho i don't have voting powers ). I would prefer a syntax similar to Hack, where you have to use parentheses = to make things more explicit. considering the following Hack code: interface A {} interface B {} interface C {} interface D {} interface E {} interface F {} function bar( ((A & F) | (((A & B) | (C & D)) & E)) $_foo ): void {} In PHP, i would assuming i can just remove the parentheses and it would wor= k as expected: wro= te: > On Tue, 23 Mar 2021 at 19:45, Matthew Brown matthewmatthew@gmail.com > wrote: > > > On Tue, 23 Mar 2021 at 05:32, G. P. B. george.banyard@gmail.com wrote: > > > > > I'm calling this proposal pure intersection types as there would be n= o > > > possibility of mixing intersection and union types, I'm leaving this = as a > > > future scope. > > > > Does this miss an opportunity, though? It's useful to be able to write > > A&B|null. > > Obviously this is less powerful than support for composite types where on= e > can use both intersections and unions. > > I've tried implementing composite types without grouping here: > https://github.com/Girgias/php-src/pull/8 > But I'm hitting various issues and I'm far from confident that I'll be ab= le > to resolve them and add the variance check code before June so that this > can reasonably get voted in for PHP 8.1. > > The end goal is support for composite types but I prefer to land a > reasonably self contained feature in 8.1 then nothing at all. > Internals might disagree with this and refuse the feature unless "complet= e" > but if that's the case there is still time to "finish" it for another RFC= . > > If someone else wants to work on adding support for composite types they > are free to work based on my PR, or collaborate with me. > > I've also tidied up the RFC: https://github.com/Girgias/intersection-type= s > > Unless someone shows up to work on composite types, I'll probably bring > this to a vote next week (if I don't forget about it). > > Best regards, > > George P. Banyard