Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113719 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 99561 invoked from network); 23 Mar 2021 14:28:45 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 23 Mar 2021 14:28:45 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 85725180504 for ; Tue, 23 Mar 2021 07:24:16 -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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-ed1-f41.google.com (mail-ed1-f41.google.com [209.85.208.41]) (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 ; Tue, 23 Mar 2021 07:24:15 -0700 (PDT) Received: by mail-ed1-f41.google.com with SMTP id j3so23625237edp.11 for ; Tue, 23 Mar 2021 07:24:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=nrMFom4cUgiPEG35P6sTAmKwX6q3mjTQRqyE97rS0YM=; b=N9sYrCamS5edRpjaQJyW8osoCpQNxZGgfc7YuW2XS4hCoKSco7pXIGwDPUwpJ5kqyP N+4P6BA0P1NbPdyF8hzcEOnApDIgXYSRt7tHVfO4blTtFqWemYYo8fzolVP5Bg9+P7IE wLAGcS/lWyzg8OdN7Wv803NO1A2qbdIfyAemWMQrmZMBmMhyjpShrYdTYmmumD8+MgAv eIVRndX3ZOt2xX84ImVVttVnX1x/v+eEuVEZK7SmAiExnL056Q6YslnXdj6Cc85XMDbO k3fT+h1CKgOXbFQY3UMMxAamtQQskzaIQ5Jarua3Cu1kUbvad5YZLKV5mGWOAtpBSYUe ZQoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=nrMFom4cUgiPEG35P6sTAmKwX6q3mjTQRqyE97rS0YM=; b=kw/CEFDF06GGn6VG0H8mKPQE/IqkNJ5drkQUKCrawMa7SpUQkSWD/PYRfw+unAkpof LMsnTusB5YbcFeg+qhBJa+EYL9ygTizrkOo95xgaY0n4QbqFcFQRnzh1BJgAkpKidWdY waIpTXjmcosg7UsNT2zBu22fwAoYKxP+s3M1WjhXxtbssjHTbkEeN0Nzf7lOryN7PVG0 Ln1a8UyUdu3LUIWuJoNO6g9lhwUVPS2TNTanVp3a0rlBUxWItWZcEYYfKO8oCBE3xxN9 StfKdei65mROYMJkiI8oDuOPj+CY1Szb8dTiVYwBWIS1Ghx9YCLMz3vDSYUJ6vo3IRtU jXGQ== X-Gm-Message-State: AOAM5332iSiwnyh9TOBzMSmGSblB/hvbFYiLixKbrWIOisDa1nHIop3M 32NrlgU9sr9ehsi0QWbEXJtaOORDkzLfAaNRhYo= X-Google-Smtp-Source: ABdhPJy2trpYLtrLlKwUicHKYvetBgRS5pLISFt8ev2cU2clreZUKRPC/ySj2VqoL/FOOlrrfMxMg3q1Glm/r1LY7zM= X-Received: by 2002:aa7:d588:: with SMTP id r8mr4848546edq.88.1616509453866; Tue, 23 Mar 2021 07:24:13 -0700 (PDT) MIME-Version: 1.0 References: <88f72c8f-3f4c-42d6-96aa-b8e9c9475a94@www.fastmail.com> In-Reply-To: <88f72c8f-3f4c-42d6-96aa-b8e9c9475a94@www.fastmail.com> Date: Tue, 23 Mar 2021 14:24:03 +0000 Message-ID: To: Larry Garfield Cc: php internals Content-Type: multipart/alternative; boundary="000000000000c6198f05be34ef82" Subject: Re: [PHP-DEV] [RFC] Pure intersection types From: george.banyard@gmail.com ("G. P. B.") --000000000000c6198f05be34ef82 Content-Type: text/plain; charset="UTF-8" On Tue, 23 Mar 2021 at 13:14, Larry Garfield wrote: > On Tue, Mar 23, 2021, at 4:32 AM, G. P. B. wrote: > > Greetings internals, > > > > I'm presenting a new RFC to add support for pure intersection types to > PHP. > > > > An intersection type A&B means that the value must be of type A and of > type > > B at the same time. > > > > I'm calling this proposal pure intersection types as there would be no > > possibility of mixing intersection and union types, I'm leaving this as a > > future scope. > > > > The current draft is located on GitHub: > > https://github.com/Girgias/intersection-types > > And the current implementation PR is: > > https://github.com/php/php-src/pull/6799 > > > > Looking forward to the feedback. > > > > Best regards, > > > > George P. Banyard > > > I love this! Thanks, George! > > A few editorial notes: > > * Under "Duplicate and redundant types", the prose says "For example, if > ''A'' and ''B'' are class aliases, then ''A&B'' remains a legal > intersection type". The code sample after it, however, says it's an > error. Please clarify. > Clarified to "runtime class aliases". > * Under "Adding and removing intersection types", there appears to be some > broken code formatting. > Indeed should be fixed now. * The Reflection section still refers to "union" types. I assume that's > because that section is still a WIP. > Correct, I completely forgot about the Reflection aspect up until I started writing the RFC by copying the union type one. I've removed mentions of union and hopefully have something which makes a bit more sense. > * Under "Future Scope / Type Aliases", you refer to "number" as being an > alias, but the code sample calls it "CountableIterator". > Indeed fixed. > Design notes: > > * Should we be planning ahead for some future where union and intersection > types can be mixed and design the reflection API accordingly? I worry that > if we have a ReflectionIntersectionType, and a ReflectionUnionType, that > ReflectionIntersectionAndUnionType is just going to make both implementers > and users table-flip. > > --Larry Garfield > Having looked at the current Reflection API for types I'm not sure something like this is necessary as pointed out by someniatko, it would provide a tree like structure by the nature of the current design. However, it might be of interest to know if other things should be added to this. Best regards, George P. Banyard --000000000000c6198f05be34ef82--