Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:92597 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 83175 invoked from network); 21 Apr 2016 15:45:32 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Apr 2016 15:45:32 -0000 Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.45 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.45 mail-wm0-f45.google.com Received: from [74.125.82.45] ([74.125.82.45:38198] helo=mail-wm0-f45.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5A/81-14036-C95F8175 for ; Thu, 21 Apr 2016 11:45:32 -0400 Received: by mail-wm0-f45.google.com with SMTP id u206so139491479wme.1 for ; Thu, 21 Apr 2016 08:45:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=oVROCozEcPTyhTFWWgZlHw3VR1u1gEuEmFobvp1Teu8=; b=CUFqL9q4gzSG6l13BBQGyOqbBKNXpKaLVhQG6OOqJ2WSk9Rj4R3Oy/ObmHwAtR14U2 d69fqS0SbnR4YijquElF0sbZERdDmzEFt34qVRiN+Zhu0APWC028vjYCFYb3lu1W2ivK QY9GXYrlIxR9J4UmB3dtz2l7rfwpEbzNNPFOekjlzAz3fxJHJ8Ym2Pm13qYL/Bnxum5g 0RnzhX8zAwk/Pt+r2ddeQksUxy7KKovJBOQFKuS90wikdHryVOlcqD7uzW0uIFMUWyrQ v59pK9lJnbBqZBTxz4Z8oOFShyZnntkUSVQpghtu8FNbLoMbE9l3xmMGbHLVj4ec3RgC +EGQ== 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:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=oVROCozEcPTyhTFWWgZlHw3VR1u1gEuEmFobvp1Teu8=; b=Ukh8wrT4OxIU+AacMGBmwD85txe0INLfcNTxwkrRux4Vy6luLkT8ZFlC+H1wbQej8m Kx10Uqu3qz0ck9/lJrSVR3+n8QArMbv5uh87ktcDh7/k1iRfTvNiSPhlaulzDwU8k5Yo C0pB67O3yvTja5+hMEupAb6qzoMJeHKRWrq5jNCCezgq/2w3j4Lt9Bu5+xfIS9Gy3Nlc CDiYSfbOlWR75vYNiktgEwGf2/wgEN7t/CzSp0TsIaACZfN4UILDiKrZFq6ipj33ENZ/ fHyiXIRYAXwcb/jJWNKZ0uJ9AAZq759KaTPH25P6VOU5sQlE1GDTA/zs5Z8Fk46BV0SH 7ugg== X-Gm-Message-State: AOPr4FU00arXrlzBu0rBm8lr0k7le7qutewUFiaDLVleHeL1fbPyZ/Nl6asEgOGMAJjR0Q== X-Received: by 10.194.231.104 with SMTP id tf8mr15073507wjc.5.1461253528337; Thu, 21 Apr 2016 08:45:28 -0700 (PDT) Received: from [192.168.0.77] ([93.188.182.58]) by smtp.googlemail.com with ESMTPSA id jr8sm3456007wjb.15.2016.04.21.08.45.27 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 21 Apr 2016 08:45:27 -0700 (PDT) To: "guilhermeblanco@gmail.com" , Jesse Schalken References: <3cc8a4c7-2640-11ae-a67b-06f909ac1e27@texthtml.net> <57173859.4080501@rochette.cc> <57180921.8020000@gmail.com> Cc: PHP internals Message-ID: <5718F530.1070503@gmail.com> Date: Thu, 21 Apr 2016 16:43:44 +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 21/04/2016 16:25: > I understand others mentioned we could create a new interface that > wraps the other two interfaces, but that still doesn't solve the > problem where I want to extend a class AND also implement a specific > interface. I covered this case in my previous mail: you can create an abstract class that extends a concrete class and adds an interface to it, and the extra methods are implicitly added as abstract for descendants to implement: // This could be somewhere else in code you don't want to touch class Foo { public function doStuff() { /* ... */ } } interface Bar { public function neededAction(); } // Wherever you need to use the intersection Foo & Bar abstract class FooBar extends Foo implements Bar {} class Foo { /* can rely on both T#doStuff and T#neededAction existing */ } // The implementation of the intersection must be in our control, to use "FooBar" rather than "Foo" as a base // This is also true of extending interfaces, since PHP doesn't do duck-typing of interfaces class FooBarImplementation extends FooBar { public function neededAction() { /* ... */ } } > What happens if the initial one get approved but it is too late to > propose the subsequent one? Then PHP 7.1 would be released with a > partial implementation and not fully featured as it should. No other part of the language allows such type algebra, so a generics implementation that doesn't allow it wouldn't feel "incomplete" to anyone who wasn't aware of the discussion. Do you consider the typehints PHP has had for over a decade to be "a partial implementation" because they don't include this feature? I'm assuming that if generics passed, and type algebra passed, then generics-with-type-algebra would go through on the nod and make it to the same version. Regards, -- Rowan Collins [IMSoP]