Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:73826 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 72405 invoked from network); 28 Apr 2014 09:24:35 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Apr 2014 09:24:35 -0000 Authentication-Results: pb1.pair.com header.from=julienpauli@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=julienpauli@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.171 as permitted sender) X-PHP-List-Original-Sender: julienpauli@gmail.com X-Host-Fingerprint: 209.85.220.171 mail-vc0-f171.google.com Received: from [209.85.220.171] ([209.85.220.171:49569] helo=mail-vc0-f171.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id CB/82-49136-25E1E535 for ; Mon, 28 Apr 2014 05:24:34 -0400 Received: by mail-vc0-f171.google.com with SMTP id lg15so7978734vcb.30 for ; Mon, 28 Apr 2014 02:24:31 -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:from:date:message-id :subject:to:cc:content-type; bh=Q2/tJI2829fYbw4OU5MJ7rkBDIALj6L1vQeicg4ueNc=; b=az20ljCLlsjOaWtnG1kTV3ceqDqULEvtkZCCEiroeqTFdd0q5rhmyp7WCcEUFYEK5p HH3aZlZrBuj0c5IgkQaPnaw77lsAPXqBfkJF35xJHA+rxsjK4lwLYDqFl92vu/UwE6+Y w9Ra/wL05/LGNewsGvDWIIUcnKM10uzO5DwP2X7zTtIZ/PczovLvesTzP1BeOcVV3xYf uJ0EpTsaOPp+DO4/2uL+8Bb/R7wchdogNbQl0jVDBXzPHp5oRwwUN6Kr8nw9g7WgajxE UNA7ZaXkN/1PijIla0VV0s9YjBxyElBHCwx+OaAqeoUo3DkSebhPqM6VIatPW2G1QAmd WroA== X-Received: by 10.220.163.3 with SMTP id y3mr22857120vcx.7.1398677071090; Mon, 28 Apr 2014 02:24:31 -0700 (PDT) MIME-Version: 1.0 Sender: julienpauli@gmail.com Received: by 10.220.81.68 with HTTP; Mon, 28 Apr 2014 02:23:51 -0700 (PDT) In-Reply-To: References: <1398437995.20097.110370617.51C52C36@webmail.messagingengine.com> Date: Mon, 28 Apr 2014 11:23:51 +0200 X-Google-Sender-Auth: iJ0D1fjGCOiGDIPBF9NedLtdUWs Message-ID: To: Levi Morrison Cc: Will Fitch , Lazare Inepologlou , internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] [RFC] Return Type Declarations From: jpauli@php.net (Julien Pauli) On Fri, Apr 25, 2014 at 11:10 PM, Levi Morrison wrote: > On Fri, Apr 25, 2014 at 8:59 AM, Will Fitch wrote: > >> On Fri, Apr 25, 2014, at 07:52 AM, Levi Morrison wrote: >> > On Fri, Apr 25, 2014 at 3:09 AM, Lazare Inepologlou >> > wrote: >> > >> > > Hello, >> > > >> > > 2014-04-24 17:59 GMT+02:00 Levi Morrison : >> > > >> > > My dear Internals friends, >> > >> >> > >> I have spent the last month drafting an RFC that allows return types: >> > >> https://wiki.php.net/rfc/returntypehinting >> > >> >> > >> Notable items: >> > >> - Differences from past RFCs are summarized in the RFC: >> > >> https://wiki.php.net/rfc/returntypehinting#differences_from_past_rfcs >> > >> - The patch includes basic opcache and reflection support. It also >> has >> > >> phpt tests. >> > >> - Informal performance tests indicate that the patch did not fubar >> > >> performance; if desired a more detailed test can be conducted before >> > >> voting. >> > >> - This RFC does not add, modify, or remove keywords at all; this >> notably >> > >> excludes type-hints for scalars. Supporting scalar type declarations >> is >> > >> outside the scope of this RFC; if you are interested in supporting >> scalar >> > >> type declarations please discuss it elsewhere. >> > >> >> > >> As a friendly reminder, everyone on this list is interested in >> developing >> > >> a >> > >> better PHP and the definitions of 'better' vary from person to person. >> > >> Please be civil and constructive while discussing this RFC. Thank you! >> > >> >> > >> Some thanks, regardless if the RFC is accepted: >> > >> - For providing a patch: Joe Watkins. >> > >> - For helping me iterate on RFC drafts: Bob Wienand, Nikita Popov >> and >> > >> Anthony Ferrara >> > >> - For previous RFCs on this topic: Felipe Pena and Will Fitch. I >> gleaned >> > >> valuable knowledge from your proposals and the discussion around them. >> > >> >> > > >> > > >> > > This is a nice and well thought proposal. >> > > >> > > I would like to suggest the addition of the "self" and "static" pseudo >> > > types. Most IDEs support this through @return syntax: >> > > >> > > class Foo { >> > > /** @return static */ >> > > public function SetBar( $bar ) { >> > > // ... >> > > return $this; >> > > } >> > > } >> > > >> > > With the new syntax, the above could be transformed into this: >> > > >> > > class Foo { >> > > public function SetBar( $bar ) : static { >> > > // ... >> > > return $this; >> > > } >> > > } >> > > >> > >> > As the patch currently stands you can use the type-hint 'self'. >> >> How will this patch work with LSB? >> > > Late static binding is not a feature I am very familiar with. After some > investigation it appears that we curently don't support late static binding > on parameters; this means that I will not support late static binding on > returns either. I want to keep the impact as small as possible. Yep, this RFC is light and that's why it's nice :-) I'm all +1 with it. Keep the impact low as well as adding a nice, more-and-more-expected feature, which keeps BC. What should we ask for next ? :-) You have my support. Julien