Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:73802 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 16951 invoked from network); 25 Apr 2014 21:10:34 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Apr 2014 21:10:34 -0000 Authentication-Results: pb1.pair.com smtp.mail=morrison.levi@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=morrison.levi@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.175 as permitted sender) X-PHP-List-Original-Sender: morrison.levi@gmail.com X-Host-Fingerprint: 209.85.214.175 mail-ob0-f175.google.com Received: from [209.85.214.175] ([209.85.214.175:58032] helo=mail-ob0-f175.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 4A/10-14326-94FCA535 for ; Fri, 25 Apr 2014 17:10:33 -0400 Received: by mail-ob0-f175.google.com with SMTP id wp4so4844756obc.6 for ; Fri, 25 Apr 2014 14:10:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=zNLW+HHSuJVARBOSObs9zbfhoRt/SCph/lAuHjiVyQM=; b=j4NP3dIr1CIUYKQ7J/2f933+Ym1pQVpNzATCm0T1de1Ccv+DBznBCycw5M2FgAtSS2 KcuhXvOcy/o4H2/wzP/b5f2GyOaIizA7pbLaWGkL7aoTkUU/CfG1z5nA64XPJThRkmts uccIy/kJT8tg/YAayyKDphyhC9otK+Jrlh1AFVsei0HVupRDVy4YaS968JhG2iPh7DCx ZCmO17MVBASoC/unKec006BiI0WYg5aYgKfZo3gCVCmGuJSWgK5hmi3KAEvQV8eraAdl 64thAgxey+qH6v5tBQaTQg1hTS2ZjP/H559mMxRl6As2LuC/opSyQDfMUYd23CzTwTF0 Ygxg== MIME-Version: 1.0 X-Received: by 10.182.55.3 with SMTP id n3mr4400136obp.55.1398460231141; Fri, 25 Apr 2014 14:10:31 -0700 (PDT) Received: by 10.76.77.100 with HTTP; Fri, 25 Apr 2014 14:10:30 -0700 (PDT) In-Reply-To: <1398437995.20097.110370617.51C52C36@webmail.messagingengine.com> References: <1398437995.20097.110370617.51C52C36@webmail.messagingengine.com> Date: Fri, 25 Apr 2014 15:10:30 -0600 Message-ID: To: Will Fitch Cc: Lazare Inepologlou , internals Content-Type: multipart/alternative; boundary=089e015387024f509604f7e46529 Subject: Re: [PHP-DEV] [RFC] Return Type Declarations From: morrison.levi@gmail.com (Levi Morrison) --089e015387024f509604f7e46529 Content-Type: text/plain; charset=UTF-8 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. --089e015387024f509604f7e46529--