Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:73784 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 38866 invoked from network); 24 Apr 2014 18:23:58 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Apr 2014 18:23:58 -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.178 as permitted sender) X-PHP-List-Original-Sender: morrison.levi@gmail.com X-Host-Fingerprint: 209.85.214.178 mail-ob0-f178.google.com Received: from [209.85.214.178] ([209.85.214.178:64011] helo=mail-ob0-f178.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 2E/93-20919-DB659535 for ; Thu, 24 Apr 2014 14:23:58 -0400 Received: by mail-ob0-f178.google.com with SMTP id wn1so3127495obc.9 for ; Thu, 24 Apr 2014 11:23:55 -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=NqFYU0oAj+tfZcR+zgzi1BxU38WbCvzFidLqPSjP7Fw=; b=OR3KzVzSv1Ouz6P9rHExl7C6nuUGZBInHMhNrgvDOp4vd80NT0KldkjdVQjRPAeJJO qqnDbjizM3K8vJ9vlOYVLtAhAfqr7fgNhkfNfV3navIjMGBdjwU9oxGyDQL4Y4CldXcw +TLe29dGGIbg4HpT0nqN3Aks1OrOLeke8Id3SYNp0KPf6r/llghjPCFDO5PAwCLPlP+A kAa3Vp4VN+vReBrVvQ+NSuWyw97V6VlOHTZoQraMnwuMk7sPh/PpFXNkgqOhYOBj8+Za 4af30qjnPLVVs9bHV3QSTL/aH/HJUZ0oaUHvridYD4UNFj0cDZcjjpEe39TwNhMqT9+/ VDbg== MIME-Version: 1.0 X-Received: by 10.60.103.210 with SMTP id fy18mr2057561oeb.75.1398363834939; Thu, 24 Apr 2014 11:23:54 -0700 (PDT) Received: by 10.76.77.100 with HTTP; Thu, 24 Apr 2014 11:23:54 -0700 (PDT) In-Reply-To: References: Date: Thu, 24 Apr 2014 12:23:54 -0600 Message-ID: To: Adam Harvey Cc: "internals@lists.php.net" Content-Type: multipart/alternative; boundary=089e0115ee7ca5fdb804f7cdf3fd Subject: Re: [PHP-DEV] Re: Return Type Declarations From: morrison.levi@gmail.com (Levi Morrison) --089e0115ee7ca5fdb804f7cdf3fd Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Thu, Apr 24, 2014 at 12:18 PM, Adam Harvey wrote: > On 24 April 2014 11:15, Levi Morrison wrote: > >> Levi, what's the syntax like for closures with use blocks? I can see > >> that looking a bit weird either way, since it's presumably either: > >> > >> function ($foo): Bar use ($quux) {} > >> > >> or: > >> > >> function ($foo) use ($quux): Bar {} > >> > >> Neither are exactly ideal, but that's the hand we've dealt ourselves, = I > >> guess. > > > > > > I believe it is the latter: function ($foo) use ($quux): Bar {} > > > > I'll check with Joe Watkins. Do you have a case for one being superior = to > > the other? > > Not really =E2=80=94 I think I prefer that one slightly, but they both re= quire > a moment to parse. On the bright side, I don't see a lot of people > using return type declarations with closures. If we ever support type hints like `function array_sort(array &$array, callable($a, $b): int $callback)` then I can see us using type declarations with closures. Maybe. So in summary: after the use statement is visually a bit better. Perhaps someone will think of one reason to do the former but I'll just plan on documenting it as the latter option. --089e0115ee7ca5fdb804f7cdf3fd--