Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:92524 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 929 invoked from network); 20 Apr 2016 08:05:54 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Apr 2016 08:05:54 -0000 Authentication-Results: pb1.pair.com smtp.mail=mathieu@rochette.cc; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=mathieu@rochette.cc; sender-id=pass Received-SPF: pass (pb1.pair.com: domain rochette.cc designates 62.210.206.189 as permitted sender) X-PHP-List-Original-Sender: mathieu@rochette.cc X-Host-Fingerprint: 62.210.206.189 texthtml.net Received: from [62.210.206.189] ([62.210.206.189:47147] helo=texthtml.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 2F/E2-14036-06837175 for ; Wed, 20 Apr 2016 04:05:53 -0400 Received: by texthtml.net (Postfix, from userid 65534) id 0C7B7232; Wed, 20 Apr 2016 08:05:48 +0000 (UTC) Received: from [192.168.1.130] (stunnel_mail_1.mail_default [172.27.0.4]) (Authenticated sender: mathieu@texthtml.net) by texthtml.net (Postfix) with ESMTPA id 6D9EF22F; Wed, 20 Apr 2016 08:05:46 +0000 (UTC) To: Sara Golemon , Mathieu Rochette References: <3cc8a4c7-2640-11ae-a67b-06f909ac1e27@texthtml.net> Cc: Dominic Grostate , Josh Di Fabio , PHP internals , Ben Scholzen 'DASPRiD' , Rasmus Schultz Message-ID: <57173859.4080501@rochette.cc> Date: Wed, 20 Apr 2016 10:05:45 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 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: mathieu@rochette.cc (Mathieu Rochette) On 20/04/2016 00:22, Sara Golemon wrote: > On Tue, Apr 19, 2016 at 1:16 PM, Mathieu Rochette wrote: >> about the upper bounds, have you consider another way of describing the >> constraints, eg: >> >> class Box where T is Boxable >> >> this would allow multiple constraints, eg: >> >> class Collection where T is Traversable, T is Countable >> > IMO, this sort of problem should be solved by combining this feature > with union types, so you could have something like: > > class Collection {... > > And merely inherit the logic rules from that feature rather than > inventing yet another one. obviously if the union type rfc passes we don't need another way of expressing this. that was only in the case it does not, I think having a way to have at least types intersection is useful here (and I didn't event think about ) > >> can generic types be nested ? >> >> class Stuff> >> > I can't imagine why not... just to be clear, it's not just nested generic. the A type have to be same in both "subtypes" > > For my part, I love the concept overall. Generics are an important > part of moving PHP towards comprehensive type-safety. But then, you > know how I feel about Hack. :) > > -Sara >