Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:74021 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 81524 invoked from network); 7 May 2014 17:02:57 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 May 2014 17:02:57 -0000 Authentication-Results: pb1.pair.com header.from=cornelius.howl@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=cornelius.howl@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.213.180 as permitted sender) X-PHP-List-Original-Sender: cornelius.howl@gmail.com X-Host-Fingerprint: 209.85.213.180 mail-ig0-f180.google.com Received: from [209.85.213.180] ([209.85.213.180:53660] helo=mail-ig0-f180.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E5/F3-56552-F376A635 for ; Wed, 07 May 2014 13:02:56 -0400 Received: by mail-ig0-f180.google.com with SMTP id c1so1368383igq.13 for ; Wed, 07 May 2014 10:02:52 -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=piFz8g/ZX4GPgqAbEaL1UsrwzPXkcP0uZFha/ZiObGY=; b=UWlrrAXanq1/cBpzRuqfoPmm806ZnzaYVv2OKSG1etnmddwh14vw8yTpi5s3GvajxB EoDHLARJ5sdSwWPbTfSvz/asyrWehqIb61eGGBnBtv1r0SFTTl8Gl9Z/PTwsPj380zb+ AnbR16iyvMfFe5sb+luWjd7CvyadPKCQze3BKJ/dv7rQSGVhoBqC+HPB/010c8H/U4nE XLSSsarTbvs6+1YBVD28XstNffGjHbu3m+utzTX/pYTTLFuQe9z7xHrrL7xxZuY/hhxB 4ruMTX4Y1qGEXUV/SMtf25UCl97k6v+5iJdnd3XWAE07HLYQamJ3lFNhJMYabJW0osZw AXog== MIME-Version: 1.0 X-Received: by 10.51.15.161 with SMTP id fp1mr45416353igd.25.1399482172683; Wed, 07 May 2014 10:02:52 -0700 (PDT) Received: by 10.64.17.163 with HTTP; Wed, 7 May 2014 10:02:52 -0700 (PDT) In-Reply-To: <535FC0DE.5050709@garfieldtech.com> References: <535E9AED.2080904@garfieldtech.com> <535ECB9E.5050701@garfieldtech.com> <535FC0DE.5050709@garfieldtech.com> Date: Thu, 8 May 2014 01:02:52 +0800 Message-ID: To: Larry Garfield Cc: "internals@lists.php.net" Content-Type: multipart/alternative; boundary=001a1134ba8ac5bb7804f8d25534 Subject: Re: [PHP-DEV] [RFC] Return Type Declarations From: cornelius.howl@gmail.com (Lin Yo-An) --001a1134ba8ac5bb7804f8d25534 Content-Type: text/plain; charset=ISO-8859-1 Hi, Why using an additional ":" symbol for the return type? what about considering this: function foo() string { } and for closure: $bar = 1; $foo = function() use ($bar) string { }; I think removing ":" symbol is cleaner. On Tue, Apr 29, 2014 at 11:10 PM, Larry Garfield wrote: > On 4/28/14, 8:30 PM, Levi Morrison wrote: > > I will attempt to contact the HHVM team (perhaps SaraG) to see if there >>>> was >>>> a technical reason for it. >>>> >>>> >>> I would agree, and look forward to seeing their reasoning. >>> >> >> >> HHVM puts the return type before the use case because: >> >> - A user is already familiar with function(): Foo >> - A use statement is not really part of the function signature (during >> inheritance and such) >> >> Additionally, it is common to write closures using their shorthand >> notation: ==> (see http://docs.hhvm.com/manual/en/hack.lambda.php) >> >> I would counter: >> - Use statements are special parameters (similar to constructor >> arguments) and that putting it after the use statement makes more sense >> - Putting it after use statements is less ugly. >> - Putting it before the use statement is a bit confusing; consider this >> Hack declaration: >> $i = 0; >> $inc = function(): Iterator use(&$i) {//... >> It looks like the Iterator is somehow using $i. >> >> What does this list think? >> > > Honestly I don't much care for the compact lambda syntax in Hack as I like > that PHP is explicit on variable capture. (Javascript isn't, and it's a > common source of errors; see the "never do this" comment on the link above.) > > > > I subjectively like the return at the very end, too. The return is the > "last" thing that matters, so it comes at the end. Too, it clusters all of > the inputs together (parameters and closures) followed by the output > (return). > > > > > --Larry Garfield > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Best Regards, Yo-An Lin --001a1134ba8ac5bb7804f8d25534--