Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:92736 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 54827 invoked from network); 25 Apr 2016 16:09:24 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Apr 2016 16:09:24 -0000 Authentication-Results: pb1.pair.com smtp.mail=rasmus@mindplay.dk; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=rasmus@mindplay.dk; sender-id=unknown Received-SPF: error (pb1.pair.com: domain mindplay.dk from 209.85.218.68 cause and error) X-PHP-List-Original-Sender: rasmus@mindplay.dk X-Host-Fingerprint: 209.85.218.68 mail-oi0-f68.google.com Received: from [209.85.218.68] ([209.85.218.68:36699] helo=mail-oi0-f68.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7C/C9-00233-1314E175 for ; Mon, 25 Apr 2016 12:09:22 -0400 Received: by mail-oi0-f68.google.com with SMTP id i2so23549571oib.3 for ; Mon, 25 Apr 2016 09:09:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mindplay-dk.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=aYlBuR5Fr7dffFWg/258OxwEB/5D5W3+V6JmlWUA0Qs=; b=j5cw6ayWSw6H6crsOxvJrmaoyOBT+ix1GX+lrAJfxlGydTEj5aObmxN6HWyHkIehD0 mX1jIlbPoNxPLHS9EuRYNncBnf2mdQJod6xMWHZnd1UiyYnvb+duKLkjwv5vH9tD9zkU sXJl4PZz1jN5q5VjjTUCVMPiZI7QJKNr6nrjhUEafqQ5DeW83Sl5JJXa03mzoO25lpRc tWrsD0AKurAWzIW4KWNw043sxJyK/UIdpRJ/d16lty44DpJyitay5S2ZKgIlM40Ca5gg csX68cgVJ6GKIOtHV0m+aXYzw82i8T73HllCsUV/4KpzKpnhrtNEAuurvnzMAyPuYszB rWzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=aYlBuR5Fr7dffFWg/258OxwEB/5D5W3+V6JmlWUA0Qs=; b=ARNK4BqFS9PudEkvBmVrN7kNrp2U3OkL3+8vE4ZXK7SIfDrSwZEBA7LbSuXg8VYumr DJ7gZgvx8tkdYBfwqG0G9LYWgytCA3cFRda2wC4/5jTR/N2ivuIbbzl4+bM9rpKFDon0 d2OtxyyY7hNFHVNBU1Hfv5LMxQN81jQwS7M2WQv39pQYcVngli1NhEJg6eKQ2gbOcI9s n8fDWhN9Epzi2xC4TVb4wHttnfARUwERMh03GgxXGwJdkMsMb+r02rabZe5ILgurUa6C vdCPCabcYLrhsMrvtBK1V55Gn7luoEOZ/6aLbFNoHHusFqtbxRi1JTRM3LLP1YujKkWC 4eCw== X-Gm-Message-State: AOPr4FUMVoaF9+NzjaF1RcCFr1zW9fxpSv3iM0v8e/O3oVIAJcQ1jJ2sPrO1uLPTW2m8xHuRxcdPBd/eyIqsaA== MIME-Version: 1.0 X-Received: by 10.202.207.85 with SMTP id f82mr14227917oig.44.1461600559555; Mon, 25 Apr 2016 09:09:19 -0700 (PDT) Received: by 10.157.37.120 with HTTP; Mon, 25 Apr 2016 09:09:19 -0700 (PDT) In-Reply-To: References: <3cc8a4c7-2640-11ae-a67b-06f909ac1e27@texthtml.net> <57173859.4080501@rochette.cc> Date: Mon, 25 Apr 2016 18:09:19 +0200 Message-ID: To: Josh Di Fabio Cc: Dominic Grostate , Guilherme Blanco , Mathieu Rochette , "Ben Scholzen 'DASPRiD'" , Sara Golemon , PHP internals , Mathieu Rochette Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] [RFC:generics] From: rasmus@mindplay.dk (Rasmus Schultz) > I really don't like 'as' in this context, even if Hack uses it, as it > doesn't reflect in English terms what the code is doing. As others > have already said, it reads as if 'T' is being aliased to 'Bar'. I second that. I hear the concerns about adding another reserved word "is" though, so I'd like to suggest simply using a ":" ... as in: class A { ... } Consistent with return type-hints, it should feel like home? For sure nobody wants to type out "instanceof", and (as pointed out in the RFC) the instanceof operator checks the type of an object, which is *not* what this is doing - a type argument is not an "instance of" anything. The ":" is more neutral in that regard maybe? On Thu, Apr 21, 2016 at 10:32 AM, Josh Di Fabio wrote: > On Wed, Apr 20, 2016 at 8: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 really don't like 'as' in this context, even if Hack uses it, as it > doesn't reflect in English terms what the code is doing. As others > have already said, it reads as if 'T' is being aliased to 'Bar'. > > On Wed, Apr 20, 2016 at 8: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. >> >> ---------------- >> >> 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.