Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:92575 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 9231 invoked from network); 20 Apr 2016 20:14:43 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Apr 2016 20:14:43 -0000 Authentication-Results: pb1.pair.com header.from=php@golemon.com; sender-id=softfail Authentication-Results: pb1.pair.com smtp.mail=php@golemon.com; spf=softfail; sender-id=softfail Received-SPF: softfail (pb1.pair.com: domain golemon.com does not designate 209.85.215.67 as permitted sender) X-PHP-List-Original-Sender: php@golemon.com X-Host-Fingerprint: 209.85.215.67 mail-lf0-f67.google.com Received: from [209.85.215.67] ([209.85.215.67:34898] helo=mail-lf0-f67.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C0/27-14036-233E7175 for ; Wed, 20 Apr 2016 16:14:43 -0400 Received: by mail-lf0-f67.google.com with SMTP id o124so6389289lfb.2 for ; Wed, 20 Apr 2016 13:14:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=golemon-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc; bh=bVXhsxuKWSIpndgOUXQajyhuCZpi1U2mNB0NPk2919A=; b=skm4tHG1//ze7UrEKsXWj1lss4BAmXWx90x2ju67dhGCkjCDi7UEJO589fjtfI2I3R S2sQIB8OBolsauNImeOro4xFsmQ6LgK4HKYy59ok88PbawgZ6l79ayEIvj/HMK3g6e8F euK6cy05QUet3lu64A6tTdGzUJrp0M9aifac9OlMuMCposmFLkwMFmT7QJpd34hgIDhX 5iDncTjQa8Usk2dWrEwlkyK9matEx1rlpjjzEgLswIqpXaxqj65JI95jGCfO0wAtbWvY m22ZSiZUX68VRyBQ394T9CgFkvMb6UVRzvRWtQyll4YbP0SO8JySpY0pyn5AW4L7TRes Qx7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:date :message-id:subject:from:to:cc; bh=bVXhsxuKWSIpndgOUXQajyhuCZpi1U2mNB0NPk2919A=; b=HCTLNU10x6I1l+hRmoDgsHMalR5U1L2La5y+07ggEHY/FeEfME8bh9UNakxXWd/U/g ICx02aTA/GPNvNCZcz/LCcEzMJJNdeRPrJO2/oUU1fjYha6o6+LbnNQTevlyxwlQ+VW7 S99GwLl/5M7hCwhkm3NbnxdU8yFis1nrT8iuK4VX3JsQFZ0WE5gnByONOY0awu5Ro8qj qmjHx4LciFEOJdA+x5CAQy9jMPjZZ33rz0UupMgF+sLGefWBAy1rLszWWMiVwVYsDggn mF6MF2Ov4i6r6UikZiP53atQ/LZHWjQwR50TOE+PSN6cInVhBhkXDs9UsSKp41FDLAX4 jNvQ== X-Gm-Message-State: AOPr4FWos0OWCvjsfh3zcOywIoXasqa+fW3hGTeS2zbzfbDNfPxYY3lze/RQYWXOcoI3X27+Bry/AnoAE0d61w== MIME-Version: 1.0 X-Received: by 10.25.20.78 with SMTP id k75mr3020876lfi.82.1461183280124; Wed, 20 Apr 2016 13:14:40 -0700 (PDT) Sender: php@golemon.com Received: by 10.112.19.74 with HTTP; Wed, 20 Apr 2016 13:14:40 -0700 (PDT) X-Originating-IP: [107.198.91.68] In-Reply-To: References: <3cc8a4c7-2640-11ae-a67b-06f909ac1e27@texthtml.net> <57173859.4080501@rochette.cc> Date: Wed, 20 Apr 2016 13:14:40 -0700 X-Google-Sender-Auth: lDqrhJ9r6YkA7j1tla7vyHm5YQ0 Message-ID: To: Dominic Grostate Cc: Guilherme Blanco , Mathieu Rochette , Josh Di Fabio , "Ben Scholzen 'DASPRiD'" , PHP internals , Rasmus Schultz , Mathieu Rochette Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] [RFC:generics] From: pollita@php.net (Sara Golemon) On Wed, Apr 20, 2016 at 12:17 PM, Dominic Grostate wrote: > 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'm against adding a new keyword anywhere we can trivially avoid it, and this is one of those places where avoidance is trivial. Preference for 'as', since it conform's to HackLang's generics (and it's fewer keystrokes), but 'instanceof' has enough clarity to it that I wouldn't complain. > 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. > IMO. This feature is complex enough without unions/intersections, and they have the concurrency problem with the fact that the Union Types RFC is also under discussion. I think if both that RFC and this one (without complex limits) both pass, then it makes sense to do a followup RFC to combine them in logical ways. > 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. > Callable is probably a bad use-case for this extension of generics, but I'd like to see array at some later point. That said, both should be considered out of scope of this RFC in my opionion. > 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. > I don't think Reflection necessarily needs to be part of the RFC, but if we can come up with something which makes sense it doesn't have to be out of scope. Really, the in/ex-clusion of this part will come down to whether or not someone comes up with a sane API for it. > 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. > +1 from me. This is an essential piece of being able to do comprehensive static analysis of PHP programs, and static analysis has already saved my butt more times than I care to count. -Sara