Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:92579 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 16849 invoked from network); 20 Apr 2016 21:02:08 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Apr 2016 21:02:08 -0000 Authentication-Results: pb1.pair.com smtp.mail=jesseschalken@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=jesseschalken@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.213.181 as permitted sender) X-PHP-List-Original-Sender: jesseschalken@gmail.com X-Host-Fingerprint: 209.85.213.181 mail-ig0-f181.google.com Received: from [209.85.213.181] ([209.85.213.181:37395] helo=mail-ig0-f181.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 9E/98-14036-F4EE7175 for ; Wed, 20 Apr 2016 17:02:08 -0400 Received: by mail-ig0-f181.google.com with SMTP id g8so62150204igr.0 for ; Wed, 20 Apr 2016 14:02:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc; bh=Y2CMayxIrJFkvvUxfqbByVDDvyrpmnQle5yJOC8k1wY=; b=mDrkqf1YpjYC7kpK+3LPC+ZR23oGxEitJtz69J5w+kiURGrhTVtQOK6xCgR60yL7kT ojsJxk36opgAnZtcAonn8VcgD6rPQxS2CUQoIyYXsDa028sktl6ENa+9tcYUx8GX8rtv dOWWEC/9UOmvFAaM5mfUKukkaPoCGjJLkHC+SarGZoaJDIzRUqLq10hOZoYDAmUJqC+5 urE3ZtzC+tWsT5yNXzXWcYRhQynIoR0M8x/ec5LEUADhTUAp/Ls63fWTzgB9YiJbQOL5 vyuOyr3R89INCqArImdKXv1cjqC694sEuDq6GJo233cVH/ppLGdvxD2apMtM3AjJgAMk 1Rjw== 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=Y2CMayxIrJFkvvUxfqbByVDDvyrpmnQle5yJOC8k1wY=; b=S4QcNLgy5YdySZohvjWly01bpvCfJyBCQNG6UOl5TE6iEnVhnDHempnQ04vJFPHSyM eWPEKZxX7he9UBeEwBjP9YW3VlRhSGYu/woM/wSS6bi4WnDxLQxZKliKQCFfU5kGuk8F O1UR2xCpruBxXP06zokMvrA/DYW9/zQm/f/dJj/MqqseyX8uZ3vFXBTHBGxqhwYCPIsB zwpp+4bPPVAnZLpYUGO73s+7G+4IAG5UgWrLiPJmuJJ2pUScHifcLPPvI0vuXtUc3IKT E3UBMntdNe/fA/M9ArSZq03LtAWVYxImRUwKhagGFlz+r1FdM2NYgPEzzfdlNMvAFCSq Ww3Q== X-Gm-Message-State: AOPr4FV94y8XGGPgW55woP997jwK4fUznVF5BxB/4llSh/dFSqGFnrBKwS3ucCQmNe9a6igqGwenoQU0gsddRQ== MIME-Version: 1.0 X-Received: by 10.50.72.107 with SMTP id c11mr6120967igv.85.1461186125014; Wed, 20 Apr 2016 14:02:05 -0700 (PDT) Sender: jesseschalken@gmail.com Received: by 10.79.139.133 with HTTP; Wed, 20 Apr 2016 14:02:04 -0700 (PDT) In-Reply-To: References: <3cc8a4c7-2640-11ae-a67b-06f909ac1e27@texthtml.net> <57173859.4080501@rochette.cc> Date: Thu, 21 Apr 2016 07:02:04 +1000 X-Google-Sender-Auth: BxnIRFZEzmWl-S08jPRzATJpE08 Message-ID: To: Dominic Grostate Cc: Guilherme Blanco , Mathieu Rochette , Josh Di Fabio , "Ben Scholzen 'DASPRiD'" , Sara Golemon , PHP internals , Rasmus Schultz , Mathieu Rochette Content-Type: multipart/alternative; boundary=047d7bdc15baeeadca0530f0e7b8 Subject: Re: [PHP-DEV] [RFC:generics] From: me@jesseschalken.com (Jesse Schalken) --047d7bdc15baeeadca0530f0e7b8 Content-Type: text/plain; charset=UTF-8 "instanceof" implies to me that the right hand side is a class/interface name, since that's what's expected with the "instanceof" operator, rather than a type. If I can do "Foo>" I would expect to be able to do "if ($t instanceof array) ...", but I can't. I think unless the "instanceof" operator is updated to be able to do checks with arbitrary type expressions, a different keyword should be used for generic type constraints so as not to imply any misleading correspondence with the "instanceof" operator. So I would prefer "as". It's also shorter, and matches Hack. On Thu, Apr 21, 2016 at 5:17 AM, Dominic Grostate < codekestrel@googlemail.com> 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. > --047d7bdc15baeeadca0530f0e7b8--