Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:111795 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 80995 invoked from network); 2 Sep 2020 20:48:55 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 2 Sep 2020 20:48:55 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 566B21804D8 for ; Wed, 2 Sep 2020 12:53:54 -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-f51.google.com (mail-ej1-f51.google.com [209.85.218.51]) (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 12:53:53 -0700 (PDT) Received: by mail-ej1-f51.google.com with SMTP id j11so472939ejk.0 for ; Wed, 02 Sep 2020 12:53:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=YlKxtgYLoOfdmLzmnGKsS/AQgZCXWBsfhnrkNBOUcAg=; b=PQoWXLO0roU2pGeLoirl/L7+hCtyb1l59zETSL5DMy42K18oqxFpXgIZozPXJZzwh8 vjf+kQHZUxJZ1Suc9JkTYcZE+MQeMfyLc8kUEMM/Y3nK4k/QyO4uWCaTWmbv9MWtx50o gYbqsCmcRhb3UQBGrpQ1wXaAI8jy2bHE7O3H141odGhga9CLL+0/EWfOJ/M6ZirOMsjS SHnQOrFns2zaLnXLgBd8XOaTPiw9FrCzmbc2uB23Y1sueP107SpCkleRxP4yQADACRRa 9qrcSfS051j+nPwwRjowgReP8jce77+lTuUaq23yHRRUbJzySPMJ40+8+QUQW9IVeCTl tP5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=YlKxtgYLoOfdmLzmnGKsS/AQgZCXWBsfhnrkNBOUcAg=; b=DyIPlaNPsH/AcWxG/uHMziSQtLCsur3pT/XE1cgdEc71QzpgJSja5dEj4cl9IMfilF amWLS3OIvDNz/59/iN2le34E3Izt/VvdJhvYlAsmgaMwY6jFXrSFC4RPNjO6G23Cyu9S VnUDGRBb5guDQzv7ZyOD8lVrPFAuTN1tlzXd8TbVOgxwU9+mekGEGuV2hvnERBhKn9IS Ioh5m1aCgog/gnm+mb0X37BCmKsuP+NDYv2VXh7/eXAyP2+SQAUEWdciyvVj5hEkd9TG lGEhDTBI1my6tSpIabBzL0e5sooyxcWCGuiy1xZ8Ss+Ve2rHWzlTFHIKAGL9wErK0h45 XuWA== X-Gm-Message-State: AOAM532z+tAW15RlWPGPCEXsgUsTQ8NXfwly9S9l+MJRFvSsizlZyNiU J/11ZZr7uhgO79q9PNybgi0/Jx2OVxfhqw== X-Google-Smtp-Source: ABdhPJwgt2vkbrFB9sMVBkBX+Cf48rE4Rp5RA+zyW9P89oj0CPY0IH0Y3r+6hvBscT2fMPLYUqfuLQ== X-Received: by 2002:a17:906:3993:: with SMTP id h19mr1727858eje.111.1599076430610; Wed, 02 Sep 2020 12:53:50 -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 d23sm520961ejj.74.2020.09.02.12.53.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 02 Sep 2020 12:53:50 -0700 (PDT) To: Nikita Popov , Mike Schinkel Cc: John Bafford , PHP internals References: <89FF9360-609A-439F-BDBE-B3B4C141E00F@newclarity.net> Message-ID: <7adfa9fc-3b20-5171-62b6-4c4df57fbe72@gmail.com> Date: Wed, 2 Sep 2020 21:53:48 +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: 7bit Subject: Re: [PHP-DEV] Draft RFC: foreach iteration of keys without values From: dik.takken@gmail.com (Dik Takken) On 02-09-2020 21:31, Dik Takken wrote: > Even if we decide that it is not worth the trouble for foreach loops, > there are other cases where this new syntax can work well. Array > destructuring has already been mentioned. Replying to myself: It just occurred to me that array destructuring already allows omitting values: [, , $username] = getUserData(); I still do find using void here more clear though, more intentional. > Another case is the one where a function intentionally does not use one > of the arguments passed to it. This happens easily when using callbacks > or when implementing interfaces. A function declaration could look like > this: > > function foo($arg, void) {} > Given the array destructuring syntax, an alternative syntax might be: function foo($arg,) Again, I would prefer to see void here in stead of a trailing comma. In function calls a trailing comma is already allowed and it has a completely different meaning, which can be confusing. Regards, Dik Takken