Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112264 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 82505 invoked from network); 20 Nov 2020 18:22:57 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 20 Nov 2020 18:22:57 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 8E5DF180537 for ; Fri, 20 Nov 2020 09:47:41 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: * X-Spam-Status: No, score=1.4 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_SOFTFAIL autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com [209.85.167.41]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 20 Nov 2020 09:47:40 -0800 (PST) Received: by mail-lf1-f41.google.com with SMTP id w142so14623292lff.8 for ; Fri, 20 Nov 2020 09:47:40 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=YQL+wbHYQhFTQ8Z8YDVIduGlmJ7q/chzyhhDgxwBsaw=; b=l64JJVZcZylNxtn0fjWdNZmVby10uUEY65DuI8NnsX8mUac2Oa8AyPl5gvudCRrfQ/ 268NrqnBpfoWvXIA4R/ZbG5PbwXUjftmKGGB/dM9cgF1zbSz0l4XFqCKVp4mz552nY4l OvI46wyPRoNkwa3SMr5IjOI+0Vltx2eb4/c9CrIn2Gfz9td61JQHnQnXvKNApXKI+Osq jIRm833o7JxjEB3WsjDpDjO4yaeRCSbWiMTg990fDepHu/U5FxG/8Yy63o8iNARN+/fx PHqQ7zCQ6jthyH/lTct6qW37zAwSNQjqbhZrxmS4wSTKT2rezlfkF3OATmgh0EsmbJmT t2IA== X-Gm-Message-State: AOAM530UfgUrIwUZIoUB2iJfKFlWYRhmScQYS56OKXEOE0zCuBDUw0Mx IhkdT28Zkz7nIp91UBbFEapjy+jarBLWsR0Q8cP6t95yz1PtLw== X-Google-Smtp-Source: ABdhPJx2luDxjXJAY4Ok9P4JiZZUeMlmCzHBhYRjyndT2mmzzE9Z6XbxaDlaCTq5aBWPY2kU+m9P8vA90cs/qx9Z+wo= X-Received: by 2002:ac2:46f3:: with SMTP id q19mr9267048lfo.76.1605894456108; Fri, 20 Nov 2020 09:47:36 -0800 (PST) MIME-Version: 1.0 References: <55e200cf-ed16-e935-4e09-728ce3362cba@gmx.de> <2369a5a3-3309-4131-81c1-4ebded96e61f@www.fastmail.com> In-Reply-To: <2369a5a3-3309-4131-81c1-4ebded96e61f@www.fastmail.com> Date: Fri, 20 Nov 2020 11:47:25 -0600 Message-ID: To: Larry Garfield Cc: php internals Content-Type: multipart/alternative; boundary="0000000000009a7e4305b48d70d7" Subject: Re: [PHP-DEV] [RFC] Draft - Closure self reference From: pollita@php.net (Sara Golemon) --0000000000009a7e4305b48d70d7 Content-Type: text/plain; charset="UTF-8" On Fri, Nov 20, 2020 at 11:40 AM Larry Garfield wrote: > > (5) function $lambda(... $args): returnType use ($captures...) {} > > > > To be honest, as I typed what came to mind, I ended up preferring this > last > > option. > > I kind of like that option, too. Agreed that this has some attractiveness to it. What does returning by reference look like in that world though? $fn = function &$lambda($args...) {...}; Capturing lambda by reference doesn't make sense when you've just declared the var, but it looks confusing AF. $fn = function $lambda&($args...) {...}; Hello PERL... > The main question in my mind is whether that means the same variable is > used internally and externally or not. > The prototype I wrote in my brain for this would have $lambda exclusively within the closure's scope, not leaked to the declaring scope. I think I prefer that even though it looks a bit odd to have a name on a function that's not accessible from where it's defined. TL;DR - Still a little confusing. -Sara --0000000000009a7e4305b48d70d7--