Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:73838 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 35696 invoked from network); 29 Apr 2014 01:30:06 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Apr 2014 01:30:06 -0000 Authentication-Results: pb1.pair.com header.from=morrison.levi@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=morrison.levi@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.219.45 as permitted sender) X-PHP-List-Original-Sender: morrison.levi@gmail.com X-Host-Fingerprint: 209.85.219.45 mail-oa0-f45.google.com Received: from [209.85.219.45] ([209.85.219.45:54082] helo=mail-oa0-f45.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AF/A0-29159-C900F535 for ; Mon, 28 Apr 2014 21:30:05 -0400 Received: by mail-oa0-f45.google.com with SMTP id eb12so8164060oac.18 for ; Mon, 28 Apr 2014 18:30:01 -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=TMAtx1bMVA1lRGZL5/sSLXy/7zzy6rfspQNPw+IzWpk=; b=fFegAX/7m9tc0ZsffEZHrbxW0ziNJZhuAkrF3umHGWoME4Hk9PGBXXTO6s8eIOtJie RTgQxgPP4vDVfQ300IDJUpXrz+DDG61f3UNGFwn1HOjbRZtfkcawnDoxH1RArs2x0uHr cD3Mir2jE6Bii/y2+YggrszoV1UTeKH2Gmg0eQTlTusZTUOq/ZNbj52yhz4WCQ/DMTnN rffpB3K5zDwW0aGzZ68J4P4mBtgVJosTRDRlz8xUJz1t7FnLTT7sO4mEvyyKenLMr8VM 4z6yKm8PqPU2o4CTseutcG0H3K5J3oIzJAiomQvUJW5CRuJzEvwRkXMSuc/TdjWDqtDs rVtg== MIME-Version: 1.0 X-Received: by 10.182.29.225 with SMTP id n1mr3924173obh.2.1398735001791; Mon, 28 Apr 2014 18:30:01 -0700 (PDT) Received: by 10.76.77.100 with HTTP; Mon, 28 Apr 2014 18:30:01 -0700 (PDT) In-Reply-To: <535ECB9E.5050701@garfieldtech.com> References: <535E9AED.2080904@garfieldtech.com> <535ECB9E.5050701@garfieldtech.com> Date: Mon, 28 Apr 2014 19:30:01 -0600 Message-ID: To: Larry Garfield Cc: internals Content-Type: multipart/alternative; boundary=001a11c2da9ceab35304f8245e6a Subject: Re: [PHP-DEV] [RFC] Return Type Declarations From: morrison.levi@gmail.com (Levi Morrison) --001a11c2da9ceab35304f8245e6a Content-Type: text/plain; charset=UTF-8 > > As far as the order of keywords in a closure, what order does Hack use? >> >>> The rest of the syntax seems based on it, so it seems sensible to >>> follow >>> suit. (I couldn't find that information from 60 seconds on hacklang.org >>> , >>> but it may be there.) >>> >> >> >> At least in the 2.4 branch of HHVM (which I have installed) they put it >> before the use statement. Now that I have thought about this more, this is >> a poor decision: >> >> * use statements are basically parameters at construction time instead >> of >> runtime >> * putting the return type before the use statement looks really ugly >> >> 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? --001a11c2da9ceab35304f8245e6a--