Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113715 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 89970 invoked from network); 23 Mar 2021 13:19:14 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 23 Mar 2021 13:19:14 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 50567180503 for ; Tue, 23 Mar 2021 06:14:45 -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=-1.2 required=5.0 tests=BAYES_05,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) (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 06:14:44 -0700 (PDT) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 934015C00E5 for ; Tue, 23 Mar 2021 09:14:43 -0400 (EDT) Received: from imap8 ([10.202.2.58]) by compute4.internal (MEProxy); Tue, 23 Mar 2021 09:14:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=1I/8IH 94/Jr+CZscpJ86bOcqCQ02C/EaqigYDVZNmUM=; b=BJHfGi09Gkor94If5A35VJ IoFjvD5F4rCpGNhvNsDJ45qZIxwfWsPXmn4h+JiyWCkR0nbqmk5SZyshxd4QcLqW WU35f1bXPTTc/yxkausCdcandJVmO6d9JC1DCT6yAhqYwQr0xJEaEvLgE1VWIKED hl4hRh2KscnPPqn9XbyxiYMFhVoAdajtCdadf6DE4LGcHd7g/l99G5RTxHqrxYHc zdeRSJ8Xx5jqzzzqjUI3X+mSeQBt44aJS2/RKJuy4h9rQm5LcqiKq5gZ4b11cO1M ekSfAYbLWNEFhyQGSKmYGNoXyoRAL5lAeVhcyG+Sdexkn8KnXrIlulMSfkiCv5Xw == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrudegiedghedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgesthdtredtreertdenucfhrhhomhepfdfnrghr rhihucfirghrfhhivghlugdfuceolhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtoh hmqeenucggtffrrghtthgvrhhnpeekteelheffgeefvddufeeujeekhfdvtdeuuedvveet ieevheeludegjeduhffhteenucffohhmrghinhepghhithhhuhgsrdgtohhmnecuvehluh hsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheplhgrrhhrhiesghgr rhhfihgvlhguthgvtghhrdgtohhm X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 294A53A0803; Tue, 23 Mar 2021 09:14:43 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-273-g8500d2492d-fm-20210323.002-g8500d249 Mime-Version: 1.0 Message-ID: <88f72c8f-3f4c-42d6-96aa-b8e9c9475a94@www.fastmail.com> In-Reply-To: References: Date: Tue, 23 Mar 2021 08:14:22 -0500 To: "php internals" Content-Type: text/plain Subject: Re: [PHP-DEV] [RFC] Pure intersection types From: larry@garfieldtech.com ("Larry Garfield") 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. * Under "Adding and removing intersection types", there appears to be some broken code formatting. * The Reflection section still refers to "union" types. I assume that's because that section is still a WIP. * Under "Future Scope / Type Aliases", you refer to "number" as being an alias, but the code sample calls it "CountableIterator". 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