Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:111797 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 87261 invoked from network); 2 Sep 2020 21:53:23 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 2 Sep 2020 21:53:23 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 2087B180537 for ; Wed, 2 Sep 2020 13:58:22 -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,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,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-f43.google.com (mail-ej1-f43.google.com [209.85.218.43]) (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 13:58:21 -0700 (PDT) Received: by mail-ej1-f43.google.com with SMTP id q13so614361ejo.9 for ; Wed, 02 Sep 2020 13:58:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=jvyf0M21ATWpNMrtRC9gVpE2TavthNepGWl0EeEQBe4=; b=H8OdBbslE5oIckWpITF1Q9cQDyLJOBfy7u0XE2H+YGrf67WOuSpQhJmHYO+yO4Eo9h ejV4r+nSx3Z6rdlO5yUSYX6N3VemcGqxpQ75Fo5Sqp73U2OHGw3zOAui1NkqBjP/wwW2 +47guaJaJ11wsFQFziuZtp9eBi/0uuTFFTjGA4FbAntly/8piFPRiz0qjvXXN2UPpc4T mnx7tEjcpHLxDTUCWbLnFBZ/Y9tcbILC7EHA3fwn5FuNxWQZeMR7EeG/RPMl5IPwaoCL mmfGQEP/zU16Llh3sfAM8tUUwuax4VyxfqNCV/+31cXgDtoZK8UFRblFXN4gIGXcWn9h FpoA== 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=jvyf0M21ATWpNMrtRC9gVpE2TavthNepGWl0EeEQBe4=; b=ZKDcQLEROFQbPCzap8jFVEeQhiTGzu3iGZOomTsUQgqSUGO7CgF/YYHQ2Z26qSyhbb EyHAo1BZyZRTyy7qKF+i2E/ejdGye8cKQ++5VWVwfFFlXbnLs3UWB7waCHCEw6n0ZC2Z TL5NkSyLppTRI7PF8z0EWJKyGg/HM3Ctm6n9T+7DZ2okLA5VkNhs6TnL6LKr+wIpNrh/ c60c0mikNLyZZ6NlxtAQnQFfE3eFMGpfjy4PvGmfgaj3lXCCaw6ucfjrcGGyBvGEoBAH vTAVvMFWsoz3XBVtSwjiUpd0k3qhSebKlNXQnl13DLQlkKZpmNBOK+SksN1u8gOT/koe zqjA== X-Gm-Message-State: AOAM530XgDj3sCzkmArTINnwQvo2aCB3FDZvAzS2W0o5eE5NbbRxntrJ rcGNLgkkIVvhJmb23SaXWRwyhxaWuVEWmkoR0qI= X-Google-Smtp-Source: ABdhPJxlEVciaE9VIBfJFGWmlNvCJD2P0gnGydOCl2dzVESmYDJvxlhksmjCxHIVe1b7+I7gRId24ZG/kgPxSPboNvM= X-Received: by 2002:a17:906:e103:: with SMTP id gj3mr1904298ejb.153.1599080300377; Wed, 02 Sep 2020 13:58:20 -0700 (PDT) MIME-Version: 1.0 References: <89FF9360-609A-439F-BDBE-B3B4C141E00F@newclarity.net> <7adfa9fc-3b20-5171-62b6-4c4df57fbe72@gmail.com> In-Reply-To: <7adfa9fc-3b20-5171-62b6-4c4df57fbe72@gmail.com> Date: Wed, 2 Sep 2020 22:58:07 +0200 Message-ID: To: Dik Takken Cc: Nikita Popov , Mike Schinkel , John Bafford , PHP internals Content-Type: multipart/alternative; boundary="000000000000457a2305ae5ae581" Subject: Re: [PHP-DEV] Draft RFC: foreach iteration of keys without values From: olleharstedt@gmail.com (=?UTF-8?Q?Olle_H=C3=A4rstedt?=) --000000000000457a2305ae5ae581 Content-Type: text/plain; charset="UTF-8" On Wed, 2 Sep 2020, 21:54 Dik Takken, wrote: > 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. > Yes, the current syntax lacks explicit intent and looks like a syntax error. Anything would be better than this, I think. :) > > 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 > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php > > --000000000000457a2305ae5ae581--