Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:73795 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 85731 invoked from network); 25 Apr 2014 10:08:37 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Apr 2014 10:08:37 -0000 Authentication-Results: pb1.pair.com header.from=pete@the-echoplex.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=pete@the-echoplex.net; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain the-echoplex.net from 208.113.200.129 cause and error) X-PHP-List-Original-Sender: pete@the-echoplex.net X-Host-Fingerprint: 208.113.200.129 sub5.mail.dreamhost.com Windows 98 (1) Received: from [208.113.200.129] ([208.113.200.129:41071] helo=homiemail-a58.g.dreamhost.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7B/10-18779-4243A535 for ; Fri, 25 Apr 2014 06:08:37 -0400 Received: from homiemail-a58.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a58.g.dreamhost.com (Postfix) with ESMTP id E48C07D806A for ; Fri, 25 Apr 2014 03:08:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=the-echoplex.net; h= mime-version:in-reply-to:references:date:message-id:subject:from :to:cc:content-type; s=the-echoplex.net; bh=+54QDkdwPx75UrnXqkuZ IslI0h4=; b=T8FsvERprRRXx/xCgejrNHloREhlf1nR2z5YVB4I7PGBZp7NbqDP 0KeVacemNbHGnAtVSHLHGyon9rNMmk87bOrKhL575xMnlWz0rT4Ct8rHp8GMvw0G ADdsttPkUNx38WgGoIyJTrCSs5kci4aDuANRtlC9Hjs5lY5e9lKxA4g= Received: from mail-wg0-f47.google.com (mail-wg0-f47.google.com [74.125.82.47]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: pete@the-echoplex.net) by homiemail-a58.g.dreamhost.com (Postfix) with ESMTPSA id 5C11E7D8060 for ; Fri, 25 Apr 2014 03:08:33 -0700 (PDT) Received: by mail-wg0-f47.google.com with SMTP id n12so172962wgh.18 for ; Fri, 25 Apr 2014 03:08:32 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.194.191.133 with SMTP id gy5mr6111713wjc.34.1398420512037; Fri, 25 Apr 2014 03:08:32 -0700 (PDT) Received: by 10.194.81.228 with HTTP; Fri, 25 Apr 2014 03:08:31 -0700 (PDT) In-Reply-To: References: Date: Fri, 25 Apr 2014 11:08:31 +0100 Message-ID: To: Lazare Inepologlou Cc: Levi Morrison , internals Content-Type: multipart/alternative; boundary=047d7b87388edde13204f7db25c8 Subject: Re: [PHP-DEV] [RFC] Return Type Declarations From: pete@the-echoplex.net (Pete Boere) --047d7b87388edde13204f7db25c8 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Nice proposal. FWIW on the `use` issue I much prefer the first alternative: function ($foo): Bar use ($quux) {} function ($foo) use ($quux): Bar {} On 25 April 2014 10:09, 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 ha= s > > 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 scal= ar > > 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; > } > } > > > > > > Lazare INEPOLOGLOU > Ing=C3=A9nieur Logiciel > --=20 Pete Boere Web Developer --047d7b87388edde13204f7db25c8--