Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:93952 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 95787 invoked from network); 14 Jun 2016 14:55:13 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Jun 2016 14:55:13 -0000 Authentication-Results: pb1.pair.com header.from=bobwei9@hotmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=bobwei9@hotmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain hotmail.com designates 65.55.111.94 as permitted sender) X-PHP-List-Original-Sender: bobwei9@hotmail.com X-Host-Fingerprint: 65.55.111.94 blu004-omc2s19.hotmail.com Received: from [65.55.111.94] ([65.55.111.94:54034] helo=BLU004-OMC2S19.hotmail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 76/93-63132-FCA10675 for ; Tue, 14 Jun 2016 10:55:13 -0400 Received: from BLU437-SMTP32 ([65.55.111.71]) by BLU004-OMC2S19.hotmail.com over TLS secured channel with Microsoft SMTPSVC(7.5.7601.23008); Tue, 14 Jun 2016 07:55:09 -0700 X-TMN: [a7N7WqEthi2iFrgx2BZ7aZKHvq9Wmsuh] X-Originating-Email: [bobwei9@hotmail.com] Message-ID: Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 (Mac OS X Mail 9.2 \(3112\)) In-Reply-To: <0fa8465c-9a1c-6328-2573-73c754022bc2@gmx.de> Date: Tue, 14 Jun 2016 16:55:04 +0200 CC: Larry Garfield , PHP internals Content-Transfer-Encoding: quoted-printable References: <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> <9c759795-a702-4f02-7eba-f1bd6fcb4ec2@gmx.de> <0fa8465c-9a1c-6328-2573-73c754022bc2@gmx.de> To: Christoph Becker X-Mailer: Apple Mail (2.3112) X-OriginalArrivalTime: 14 Jun 2016 14:55:06.0984 (UTC) FILETIME=[BD846680:01D1C64C] Subject: Re: [PHP-DEV] [RFC] [PRE-VOTE] Union types From: bobwei9@hotmail.com (Bob Weinand) > Am 13.06.2016 um 14:36 schrieb Christoph Becker : >=20 > On 04.06.2016 at 16:37, Bob Weinand wrote: >=20 >>> Am 4.6.2016 um 16:17 schrieb Christoph Becker : >>>=20 >>> On 04.06.2016 at 14:15, Bob Weinand wrote: >>>=20 >>>>> Am 04.06.2016 um 13:45 schrieb Niklas Keller : >>>>>=20 >>>>> 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. >>>>=20 >>>> 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. >>>=20 >>> In which case it might make sense anyway to use adapters. >>=20 >> For which you then need an adapter for each and every combination of = interface (power set without empty set; 2^n - 1 - 15 adapter classes for = 4 interfaces). >> That=E2=80=99s not a practical solution here. >=20 > After having a closer look at the referenced code[1], I agree. = However, > in this case it would still be possible to avoid overloading the > function by having a dedicated function for each type (i.e. > useCallable(), useMiddleware() etc.) That doesn't appear bad to me. >=20 > [1] > = >=20 > --=20 > Christoph M. Becker Principally, yes, it's possible. The reason we've chosen to not do this: A class is often a module which may need to be callable, middleware and = monitor at once. It allows us to have the user not know about what = exactly he implements (in the sense of "this module is middleware and = monitor"), but to just tell him "here's our module, just use() it and be = done". It eliminates the need of the user having knowledge of that. (=3D> user = friendliness) Bob=