Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:93765 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 67712 invoked from network); 4 Jun 2016 14:17:59 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Jun 2016 14:17:59 -0000 Authentication-Results: pb1.pair.com smtp.mail=cmbecker69@gmx.de; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=cmbecker69@gmx.de; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmx.de designates 212.227.17.22 as permitted sender) X-PHP-List-Original-Sender: cmbecker69@gmx.de X-Host-Fingerprint: 212.227.17.22 mout.gmx.net Received: from [212.227.17.22] ([212.227.17.22:59056] helo=mout.gmx.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FF/A4-25194-613E2575 for ; Sat, 04 Jun 2016 10:17:58 -0400 Received: from [192.168.2.102] ([79.243.113.142]) by mail.gmx.com (mrgmx101) with ESMTPSA (Nemesis) id 0LwW8p-1bY0eY0B3P-018N0V; Sat, 04 Jun 2016 16:17:49 +0200 To: Bob Weinand , Niklas Keller References: <0A.C5.62101.1C860575@pb1.pair.com> <68b821ac-d71f-4be5-8dca-ae94db332630@gmail.com> <20160603101659.D466A1A81FC5@dd1730.kasserver.com> <6d448fd8-8fda-d795-accb-6b96cd128ccd@gmail.com> <652fdc5a-a164-2054-ed61-305a2b72330a@gmail.com> <20160603142421.346B81A81725@dd1730.kasserver.com> <9814df22-9854-616b-bf02-d0742efefaff@gmail.com> <20160603145857.8413F1A8323C@dd1730.kasserver.com> <1fb072b3-9b9e-1dfd-6b39-7875587b6c7d@seld.be> <5751B50F.2090003@garfieldtech.com> Cc: Larry Garfield , internals@lists.php.net Message-ID: <9c759795-a702-4f02-7eba-f1bd6fcb4ec2@gmx.de> Date: Sat, 4 Jun 2016 16:17:55 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:3UmveX8Kfb9njGK9pZKLng87aw3Ek1OSbpHiI86VUeUc3R7X0wh zddfOH41hYKv7YkWkcWFEYsR/QomTpdncug4bM33tMXkuZzmIEuSf+13CDQM8ipkOFgXa3g v9+HmjbRu7ZJgWzxpFDIXrXqhKZ8MndvL5vlWk28OCDxOzP5eT5snhTjwhNObpt7O5nW+8n lJ1aXEoXOKtE+9mNtp/0w== X-UI-Out-Filterresults: notjunk:1;V01:K0:WhFEaNWjpGY=:Fep3P/0tvtkTg8Gw5C+uX6 sLd8eCSzZxRRm7h2pdowGex/KELDY5dsUKxwL82Brk9BeZ/xp3PWn9/PpMMK/u2/H1T2sf2yY FUPIIoPl6ITy1V0M7579o+RbWXEh+LJSVXI3AbfvL0S+alrGf8LrVSNJl4JlCd8n3PfoxT1Xc JeofwBt6cog0MxCFoGFWkCokQT8Y5GGW2yNi/GaAtNt30zXzYI1rQhEI/8nCp0Ay4TL/358jZ tn12TR+b3xHHI81FJMImu0v45JrvUQwseJrQvqZ1D7TFEyJCg89VYCeqV9hyeQugm5cGWcZvo XchL4Qf5pyHv7nMWECtbdWFwVqAOFlq0tICGRQCt3IQPBd31pp+wDn4+k6QSi7PFTEeOWMacY Dc/6vnvqXUfA3xgb+4aHRqsRw1K6+EVsj7ssrADDn4bJdgI3ZSYhm9ubF5TOH2bhNN+OZt/cs YSfkq7znXujCngiOEM2snU+1REDp2RqOoS14fsJbbTde7Km3RoCJ99gLyKpSXaBqVuX3ZQup7 mh7n+fa7DMsXaU33C5WFMnf0veOwIWsoLYs83PAX0e/Cujq0rmCaeYdi+tKXOk4rCG1cF0s/S 3XgQ48NVDQ+xwsdZwP7UoiuPeXGQdvgPw6WJUA9Jqm+jU9sEvo9oGYtKty3fRAsUqdvK1kdbT fevfGffrvw7pArbzYFgHI27ub4ra0FZ1pZIYeK5BiKwOqynAZ2bZtgkEPhdNcjomfwZTS2r9V u2a7S5kwSSycY+RTjpDOVZyqrRYeRBwBlg10NWf+ZLhab5wosyufvHB20SCokk03REEeUwX02 gJKyJNh Subject: Re: [PHP-DEV] [RFC] [PRE-VOTE] Union types From: cmbecker69@gmx.de (Christoph Becker) On 04.06.2016 at 14:15, Bob Weinand wrote: >> Am 04.06.2016 um 13:45 schrieb Niklas Keller : >> >> For Aerys\Host it could also be solved with an interface that just doesn't have any methods. With the disadvantage of callable not being in the same signature anymore. > > Also, it requires you to inverse responsibilities. You'd have to specify a common super-interface on every single fundamentally unrelated interface (which are only indirectly related by the fact that they receive common handling in a single place). That's a clear anti-pattern. I agree, but I can't see why using a union type would be much better, as you would still bundle up a bunch of "fundamentally unrelated interface"s in a single (union) type. While I see a small benefit in the explicit notion of the union type in the function's signature, that would completely vanish if we introduce some kind of type aliases later (as already noted in the "future scope" section as potential improvement). > Additionally, this is only possible if you are actually in control on these classes and can change them. If you pull them from a library, no chance. In which case it might make sense anyway to use adapters. -- Christoph M. Becker