Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112280 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 67233 invoked from network); 24 Nov 2020 18:01:55 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 24 Nov 2020 18:01:55 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 28C0A180531 for ; Tue, 24 Nov 2020 09:27:39 -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.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-vs1-f50.google.com (mail-vs1-f50.google.com [209.85.217.50]) (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 ; Tue, 24 Nov 2020 09:27:38 -0800 (PST) Received: by mail-vs1-f50.google.com with SMTP id u7so11498265vsq.11 for ; Tue, 24 Nov 2020 09:27:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=basereality-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=s/2i1eeAQLuOlyeg2maF9KrhIjk7dWP0Z6+I9nBLkBI=; b=w7Ni0WX5tq2ZBDUU1DFA0bDfIkedLgUjsr2Q7d7rJl4OSMBkE7Y4+LgZLiUTfH/0F1 MOqRtLEdiUYd+R5vJ+Mnlwa3YVxfAZI0YW3p5fVY27x6EJmt7eZ67n2a9RWk71N3Fjl7 I285Aj59w/jWvJZ2d8mqnHIVAkVU45W9h1TPQ5PdeEe7N50K+YJp6P9Rf7ihHcSfgKpk 083l5NsR1W68BkvSyMQFSzX41qyL4KQyCGuh3tpVG0JN/VMzjvdkVwSzyvHgS7NsCTyK YekGu3OeqpkuoM9QDra8KgXMlX3rMxeqHfx9Z58GGQmIzSYUAldM7Xxb/srtqSRNfZaI FWBA== 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=s/2i1eeAQLuOlyeg2maF9KrhIjk7dWP0Z6+I9nBLkBI=; b=BwfErwiMqXF7IuiBjenHe2lo61iXaVukbqgYwQsH1buhXYOb9kaZwEu1ltEnjw1Xxc XJwFJFzI+dXKFl4rIEdoeYaKIdkeA4JiMGD/bZsTN4pozf02igk2CJkDY1TtrkhA9y6U vBho8jM9pxKvnbW/Kpm/2OwpZw2xrKuL+6wcOUrA0Jnn2e9CX5IU267WjACCRKc29rzb fw7kamWwqWlS/NIiSKuuLqapmFlS9DC6kSq2iQOILskzFr8PQKcorp/1m5c9YhjIsRPp cT1Fq945TigkfXaVLjEpmr/mYT24g0SvO9/zpIYt1vf2v862Ogf2cxcd4qDnTolLAiV+ jfOw== X-Gm-Message-State: AOAM530BUifKbpvHxH8xBtriaHnIV7Ao8f1knm505XcIkeTHqi9RgZNK lodWDjGdbp+0hjyWByRlyw3d5FkKw8Gbghs7kxP5jUSSGMJMVrSZ X-Google-Smtp-Source: ABdhPJxGHQBz3KIDr6ydzKJh/hqy4maQk4ZqAV5yD5cKs10z/6RZ3XSsfzCbUYG0zzvaYeMOPcb0uyvQBxLSadigF0w= X-Received: by 2002:a05:6102:249:: with SMTP id a9mr4959704vsq.1.1606238855188; Tue, 24 Nov 2020 09:27:35 -0800 (PST) MIME-Version: 1.0 References: <55e200cf-ed16-e935-4e09-728ce3362cba@gmx.de> In-Reply-To: Date: Tue, 24 Nov 2020 17:27:24 +0000 Message-ID: To: David Rodrigues Cc: PHP internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] [RFC] Draft - Closure self reference From: Danack@basereality.com (Dan Ackroyd) Sara Golemon wrote: > looks a bit... ugly? weird? surprising? I had the same initial reaction, and was going to tell David what I thought of the suggestion. But after a couple of days, I was unable to actually articulate what I didn't like it, so think I was just having a gut reaction to something I hadn't seen before, and so wasn't used to seeing. Sara Golemon wrote: > That's a lot of... stuff Yeah, but it's a really rare use-case for a closure to need to be able to reference itself, so I think it's probably fine to have some verbosity around "this closure is doing something quite unusual". I personally think any of: function (... $args) as $lambda: returnType use ($captures...) {} function (... $args): returnType as $lambda use ($captures...) {} function (... $args): returnType use ($captures...) as $lambda {} would be fine and various 'my aesthetic choice is objectively the best' arguments, could be made for any of them. David Rodrigues wrote: > I ended up preferring this last option. I prefer the others as I think they are more deliberate syntax (i.e. don't look like a typo), avoid confusion around why can't normal functions be declared with leading $'s, and almost certainly would be easier to search for what they are. e.g. "php closure as variable" cheers Dan Ack