Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:92585 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 33546 invoked from network); 21 Apr 2016 00:40:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Apr 2016 00:40:29 -0000 Authentication-Results: pb1.pair.com smtp.mail=mathieu@texthtml.net; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=mathieu@texthtml.net; sender-id=pass Received-SPF: pass (pb1.pair.com: domain texthtml.net designates 62.210.206.189 as permitted sender) X-PHP-List-Original-Sender: mathieu@texthtml.net X-Host-Fingerprint: 62.210.206.189 texthtml.net Received: from [62.210.206.189] ([62.210.206.189:60769] helo=texthtml.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F8/3B-14036-C7128175 for ; Wed, 20 Apr 2016 20:40:29 -0400 Received: by texthtml.net (Postfix, from userid 65534) id E6702235; Thu, 21 Apr 2016 00:40:25 +0000 (UTC) Received: from [192.168.1.70] (stunnel_mail_1.mail_default [172.27.0.4]) (Authenticated sender: mathieu@texthtml.net) by texthtml.net (Postfix) with ESMTPA id A657223E; Thu, 21 Apr 2016 00:40:22 +0000 (UTC) To: Dominic Grostate , Guilherme Blanco References: <3cc8a4c7-2640-11ae-a67b-06f909ac1e27@texthtml.net> <57173859.4080501@rochette.cc> Cc: Josh Di Fabio , Ben Scholzen 'DASPRiD' , Sara Golemon , PHP internals , Rasmus Schultz , Mathieu Rochette Message-ID: <58b33375-f4dd-dd1e-e658-5f7df3027cd2@texthtml.net> Date: Thu, 21 Apr 2016 02:40:19 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:47.0) Gecko/20100101 Thunderbird/47.0a2 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------91267382AF026D0FDD721340" Subject: Re: [PHP-DEV] [RFC:generics] From: mathieu@texthtml.net (Mathieu Rochette) --------------91267382AF026D0FDD721340 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit On 04/20/2016 09:17 PM, Dominic Grostate wrote: > Thanks for you're input everyone. > > So far, we have read some ideas for handling upper bounds, or multiple > there of. > The preferred keywords appear to be either "as" or "instanceof". > > class Foo {} > class Foo {} > > We would like to know for sure then if everyone is largely against the > addition of an "is" keyword, in favour of one of the other two. I don't mind having a new keyword and is would be my first choice because using one of the other two would feel odd. in T instanceof Bar I expect T to be a variable, not a type and with T as Bar I feel like I'm telling PHP "T is not a Bar but treat as if it is" I'm not that well aware of the implication of adding a new keyword but I thought it would not be a big deal since https://wiki.php.net/rfc/context_sensitive_lexer has passed (I'm not saying it's not important, just that using the most appropriate keyword is very important too) > > ---------------- > > There is also a desire to include unions and intersections. > Presently though, this feature feels tied in with > https://wiki.php.net/rfc/union_types meaning if union types are approved, > then generics would have to support them as well. Likewise if this feature > becomes approved in generics, it would make sense to support them in > regular type hints as well. > > ---------------- > > The RFC makes a reference to generic closures, which may look something > like this: > > function my_function(callable $func) { > > } > > However, an RFC already exists which is very similar to this feature at > https://wiki.php.net/rfc/callable-types > As it currently standards these RFCs appear incompatible with each other > (please correct me if I am wrong). > > My question about this is would you prefer the generics RFC exclude this > part in favour of a separate or later RFC. > Initially the proposal included generic arrays "array". However to > ease the implementation it was decided that should be a separate feature. > So we'd like to find out if everyone else feels the same way about callable > types. > > ---------------- > > This RFC currently doesn't specify in detail how reflection would work. We > have attempted a few API designs, but due to generic classes being ... > generic, it is difficult to find a suitable way to glean information about > a class in a backwards compatible manner. So we will need some help on > this one. > > ----------------- > > Aside from these top issues on our own list, however does everyone feel > about the proposal in general? > As the RFC is still in draft, we will continue to make changes to it as > more popular idea pop up, so please continue. > > Thanks. > > PS: I wasn't properly subscribed to the mailing list, so I missed a few > important messages that were mailed directly to internals, but hopefully > I've managed to fix that now. > -- Mathieu Rochette --------------91267382AF026D0FDD721340--