Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:92553 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 62888 invoked from network); 20 Apr 2016 15:30:35 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Apr 2016 15:30:35 -0000 Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.51 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.51 mail-wm0-f51.google.com Received: from [74.125.82.51] ([74.125.82.51:36521] helo=mail-wm0-f51.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 13/8E-14036-B90A7175 for ; Wed, 20 Apr 2016 11:30:35 -0400 Received: by mail-wm0-f51.google.com with SMTP id v188so208575498wme.1 for ; Wed, 20 Apr 2016 08:30:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=Vs74cu7flQfRESoujiOs1W11JMPJlpF7WDOi88WTgXg=; b=cw9n85StMG/8tCOg0k88YEYaFXEYARVQzZq39fpBgZKb3DbItHaY/WSAn+S4WTPKFP oV2VI9o9wtTSs1ioroWs2o0wNuDCalg9tf4kK5AYL2kzkd8HxdEEbmy3tJOL0kdM+FOh Ui1cGmiebzU74xtV/+ttpWWRRPvjikC1fFPygwH5aGu96PwvB35eNNk5kOWDF4R1A0PU TiRmByEwznBJr+eRUwIATQua14HAJzd8GDyB5Tb3yOExTQlKR/QHNeobXbXFTalarg2P bXnwcQLOzGbjufECyfLFSnvbpt48oZIcmgRighlkNYeQ0GOX+xfYm0XzKWBzUVAvDrWQ 2/6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=Vs74cu7flQfRESoujiOs1W11JMPJlpF7WDOi88WTgXg=; b=PU2m0gEVwxWmkYZqEsHjebW76nvb8yAUfx5pflYNiXcZV289TANEK8pqb6MfYclUYV Z6yQAJljplx4v9URJFThQwwH+G3ZfA/a/N+jukzqXsLu9fS4B4kiLx9tHsFiAnmOTAlV dSY+j8Vq8kQY0aa5wvq8bc6BvvYxvM+t/oifvNob9jS9/BrFxH4h3pYUEFmnLOlRmCsW Syl9nKWaU12l5c3hj765hzLV9PBejiOSkkfZ2S4lc2haBrYzsrD0YdGXXGZtZhrWnBrY rW5Ag9PzZYpnKHXbL5xwxT/u0vI0oJTPX8PAV7ZLlSffslVt9SzuSbInx/3TDmLISjSg 69TQ== X-Gm-Message-State: AOPr4FWWLoK0bdfJaG50Kscfbl10WPN6FKF/QF+7uMrOuCEVTXWmOlVQEriEKc9wrDEJiw== X-Received: by 10.194.205.167 with SMTP id lh7mr9330900wjc.30.1461166232098; Wed, 20 Apr 2016 08:30:32 -0700 (PDT) Received: from [192.168.0.77] ([93.188.182.58]) by smtp.googlemail.com with ESMTPSA id jp2sm6172965wjc.16.2016.04.20.08.30.31 for (version=TLSv1/SSLv3 cipher=OTHER); Wed, 20 Apr 2016 08:30:31 -0700 (PDT) To: internals@lists.php.net References: <3cc8a4c7-2640-11ae-a67b-06f909ac1e27@texthtml.net> <57173859.4080501@rochette.cc> Message-ID: <5717A036.7090908@gmail.com> Date: Wed, 20 Apr 2016 16:28:54 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC:generics] From: rowan.collins@gmail.com (Rowan Collins) guilhermeblanco@gmail.com wrote on 20/04/2016 15:44: > In a given class, I might want to only accept CacheDrivers that also > support BulkOperations. How would I achieve that? Apologies if this has been refuted elsewhere, but AFAIK you can implement any intersection constraint, albeit slightly more verbosely, by creating a new type: - You can create a new interface that expresses an intersection of two other interfaces: interface BulkOperationCacheDriver extends CacheDriver, BulkOperation {} - Similarly, the intersection of a class and an interface can be created as an abstract class: abstact class BulkRedisCacheDriver extends RedisCacheDriver implements BulkOperation {} Since you can create those without modifying the underlying classes, you could specify generic constraints for any given intersection. A union constraint ("it can be either this or this") cannot currently be implemented, but the use cases are somewhat more questionable anyway. Regards, -- Rowan Collins [IMSoP]