Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:92867 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 24066 invoked from network); 28 Apr 2016 15:11:48 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Apr 2016 15:11:48 -0000 Authentication-Results: pb1.pair.com smtp.mail=guilhermeblanco@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=guilhermeblanco@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.161.175 as permitted sender) X-PHP-List-Original-Sender: guilhermeblanco@gmail.com X-Host-Fingerprint: 209.85.161.175 mail-yw0-f175.google.com Received: from [209.85.161.175] ([209.85.161.175:34725] helo=mail-yw0-f175.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C9/E0-17003-23822275 for ; Thu, 28 Apr 2016 11:11:46 -0400 Received: by mail-yw0-f175.google.com with SMTP id j74so109907563ywg.1 for ; Thu, 28 Apr 2016 08:11:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=gQL+ebdzjG7BFixYxpHXzB9Kekz6dcuG8PXn1ANfVOU=; b=DjkieQteKcKtHWBluOCTUnkoRvA2JjZyvrXLYoLdrky42mOCtmzKz5y9SixXFpLwQ9 8bF0rDBFMGByE386gEF6whUsXrxl8cpjo6DA9RXuS9G85OYvCpFBMkbVFME17l2PM0uK owx0XzS0w4yYubqrh+YDC5QyppZ4eacvvCJa8RplbYqSthOE5a/641FKIy3j54W5p/nW dSoMa4dkDEMYDD3M8nDkvAf47gbzNJQ99HFlvdoBPUXDuA1TnX0WDSfwX4E3UgcjIfBa 3cr/1bzoQSs7VeB+ya3OIYW4qNsvGT4DjodmTeQv0H+j6FG18U6XegCw8tZaR+QjOgvA uscg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=gQL+ebdzjG7BFixYxpHXzB9Kekz6dcuG8PXn1ANfVOU=; b=Tfuymk1cl6bY9KEZWLYmidMdom9KmmjkmL5gcCpvJ8wNU7JoCEZy/wvAo0A8Sm0HyM LjGt3p1vMhT3jRIjlEa0ziyTMIls8sRnnUrXLW9GZKY9Q6d4nX29NT+qGzOAjMK2hGTD ylHAKC2BYItgAO2x3bK69+Cqe+FR6u1oIhoUn8fHEtaRD0AD4QXFGRW2XefTatyor1p3 V7zpljYArnrytPl+dIAVIiFRIe9xu4k31mg2VbMyoMbjEXC8vEBF/EcZmt87yJTIjcbF 4WZYFrtC3CbMzhh7KPomEvl3ptOUGs7AZG2QFqYd/UYRp21ngGkanF43cVNDMnUW0Z0J KwlQ== X-Gm-Message-State: AOPr4FVvNU26F5x6PQTEricLnBWn/0t9C0VtSv0dURRQRYbv260+83tyEFubb3hTN4ljZGtbzH7vn5R3OMq7iA== X-Received: by 10.129.122.17 with SMTP id v17mr8074196ywc.219.1461856303544; Thu, 28 Apr 2016 08:11:43 -0700 (PDT) MIME-Version: 1.0 Received: by 10.37.115.151 with HTTP; Thu, 28 Apr 2016 08:11:24 -0700 (PDT) In-Reply-To: References: Date: Thu, 28 Apr 2016 11:11:24 -0400 Message-ID: To: Josh Di Fabio Cc: Levi Morrison , internals Content-Type: multipart/alternative; boundary=94eb2c07b4a0af7ec105318cf1bd Subject: Re: [PHP-DEV] [RFC] Intersection Types From: guilhermeblanco@gmail.com ("guilhermeblanco@gmail.com") --94eb2c07b4a0af7ec105318cf1bd Content-Type: text/plain; charset=UTF-8 Nice! I've read the RFC and there's only one missing thing that is either undocumented or missed during patch creation: instanceof. I'd be amazing if we could do: $foo instanceof Foo & Bar Cheers, On Thu, Apr 28, 2016 at 5:00 AM, Josh Di Fabio wrote: > On Thu, Apr 28, 2016 at 4:54 AM, Levi Morrison wrote: > > Internals, > > > > As alluded to last week I have another RFC for improving the type > > system: [intersection types][1]. > > > > It allows parameters to define multiple type constraints that must be > > satisfied. Common combinations of our built-in types include > > `ArrayAccess & Traversable & Countable` and `Countable & Iterator`. > > > > Some people have suggest I merge this and union types into one RFC. > > For now I'll just proceed with them separately to gain feedback. > > > > [1]: http://wiki.php.net/rfc/intersection_types > > > > -- > > PHP Internals - PHP Runtime Development Mailing List > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > To me, it seems that intersection types are more useful than union > types (other than the obvious null|Foo and array|Traversable cases) as > they'd allow us to write smaller interfaces and better follow ISP in > userland, with interfaces becoming much more convenient for > documenting the requirements of a parameter. > > At present we tend to have incomplete implementations of interfaces > (e.g. throw OperationNotSupportedException). Union types would allow > us to create more, smaller interfaces and avoid situations where the > type of a parameter doesn't accurately reflect the method's true > requirements, or where concretions are incomplete implementations of > an interface. > > Thanks for your efforts, Levi, I'm excited about this one! > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Guilherme Blanco Lead Architect at E-Block --94eb2c07b4a0af7ec105318cf1bd--