Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:111777 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 19478 invoked from network); 2 Sep 2020 12:22:23 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 2 Sep 2020 12:22:23 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 87858180088 for ; Wed, 2 Sep 2020 04:27:16 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-ej1-f49.google.com (mail-ej1-f49.google.com [209.85.218.49]) (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 ; Wed, 2 Sep 2020 04:27:16 -0700 (PDT) Received: by mail-ej1-f49.google.com with SMTP id lo4so6096638ejb.8 for ; Wed, 02 Sep 2020 04:27:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=ePK74UyzD+PnHVWOERIQvTCfwSwOyC95yNFEMMvzdQU=; b=SphH9vRZJYFrpBhvGj41N9lah7LLiflRdDpSWPT1lcWfr7FA6T0Pmtu3LXsEXoUpr2 DDT00j9PcKIOR6UWO00fNoobCQ6QGA+GHvzMTrDQADjf6pu3HstGj3NO5jLl2LUpXrJl bSnNlN78pki0rleEOyB+G+BMuE0DsOevsdKkQyYPMz4qzZuUtiRBa2nB+1WeXFyCAtZE msaiPJzGw74peWjVWFrX6ZtwKt2Zd3TIPTfWydRugt1h9mTMlKZYQAHGPk6NrCkPlGrM oDRhg7SGUr0xC1KPsdK1dhhJJvXUTH+H6tSB1VbvVvqkxGF88NpbFT5NCbI6tHO8C2/c brug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=ePK74UyzD+PnHVWOERIQvTCfwSwOyC95yNFEMMvzdQU=; b=sT+N2an1uHSll7Lx1St+gJ1OTRdwW80Tv031uSTsYsDL/FViwWTAMsk474LaBpb4LE nVCC6yksdLXKkhPMIN7PQunT3dmBqln9uuF/n2yq1s1BnA69nbn6nyTcEcw+dUXhsJyS /0y5ceOBmrTGss4sB8AdS/W4geW6F/nc08HpDrQlU1XLNzvQ9ifVIc30KSBlkeDNDL3C 0BcOYVG2zej/2Yek9TM1LzTpuAeSIiCGC1GTIU9+5JLDRFd7gLz/I0jyKj6KVckaR4Cp gQMc6Nga6Xlz8dn4gGQRA0MzuFXINhsYld21r5bqo8IOruUaoToXlPCo7I4xFRBEE7KL qbxg== X-Gm-Message-State: AOAM531Ihug0x7VOkSKtofwN57idRVDQ05DrV8Zh3g6f8xnk2e30Xr77 z9z/L4FDYP0bi+5AVouZL8Xu1ZBF4ThOMw== X-Google-Smtp-Source: ABdhPJwndaqjs9XPtCowTme2MQg1NUhtgJb5MNZrremKhnhEfTbRVEK+fgU8l7GTuulOEDggAXLB2g== X-Received: by 2002:a17:906:e8f:: with SMTP id p15mr6132028ejf.290.1599046033203; Wed, 02 Sep 2020 04:27:13 -0700 (PDT) Received: from ?IPv6:2001:983:6fc5:1:49c7:735:8c90:b4f5? ([2001:983:6fc5:1:49c7:735:8c90:b4f5]) by smtp.gmail.com with ESMTPSA id gw6sm3868529ejb.47.2020.09.02.04.27.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 02 Sep 2020 04:27:12 -0700 (PDT) To: =?UTF-8?Q?Olle_H=c3=a4rstedt?= , Mike Schinkel Cc: John Bafford , PHP internals References: <89FF9360-609A-439F-BDBE-B3B4C141E00F@newclarity.net> Message-ID: <8f723fa1-1c0c-2095-1264-a1aa565db90a@gmail.com> Date: Wed, 2 Sep 2020 13:27:11 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] Draft RFC: foreach iteration of keys without values From: dik.takken@gmail.com (Dik Takken) On 02-09-2020 12:48, Olle Härstedt wrote: > An alternative syntax would be > > foreach($iterable as $key => _) { ... } > > Using underscore as a way to signal "I don't care about this value". > Same could be possible with list destructoring, like > > [_, _, $something] = foo(); > > This syntax comes from OCaml. Possibly other languages, too? Not sure. The underscore is also used for this same purpose in both Python and Javascript. However, it is a normal, valid variable name in those languages. It is not in PHP. I think I would prefer '_' over 'void' because of consistency with other languages. However, we should also consider that: 1. It is currently a valid constant name (BC break) 2. It might be ambiguous in some contexts in which we may want to use it in the future. We should carefully consider other possible use cases like array destructuring. Regards, Dik Takken