Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:111834 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 51415 invoked from network); 3 Sep 2020 20:49:20 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 3 Sep 2020 20:49:20 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 250F9180546 for ; Thu, 3 Sep 2020 12:54:33 -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_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-ed1-f42.google.com (mail-ed1-f42.google.com [209.85.208.42]) (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 ; Thu, 3 Sep 2020 12:54:32 -0700 (PDT) Received: by mail-ed1-f42.google.com with SMTP id l21so3882022eds.7 for ; Thu, 03 Sep 2020 12:54:32 -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=tXUENSQ3ClTjjj9prgWLKOmBj2lNvZ4wan00PxHOs1w=; b=Ex3495zmP6zt6c0jx01bOA+LL/4FPl2AhZTBhEhVmneqH8gdweHslo3nkRdXlcsUeP I7JFuRYwfXcaPof9XCr1k/iqqcX2RgrY4CvZkC5hcrI80bUSHap1VLUJ5FmQSk9pEYlF XSAL5cLPn5bW9VBn8E5MLGVCtBvV3DrwLliLXsQwBtvPTWa2uMa+m5G1Ike54Ysie1+T LjSZ9aLLMiGctYsh/X482lB28n2pyHhKRpGiEeJcqI6lP1wlTN8WdNylOwvSLL965BND ajJtFBJkztvFu5A+DThCRF5GBXeIuik34lZwFXgXcCgaugBHOMdlDyGrvEeYzyZXiPO6 +3Sg== 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=tXUENSQ3ClTjjj9prgWLKOmBj2lNvZ4wan00PxHOs1w=; b=LWj2PFaHjmVErN4zUROw7bASS+QqWDkFkg3kx+oO/6PWs2+D+bf2w/jwzNMMwt9w35 WbkYMVZqFKll5ewpT0caVaevlm30XZkAMjEEy8mQulJOR+k8K0FL99um6+A+eaDR5/Zn WZu7S7vgRkiKhiuHsnAVD9Fn02+L5xCAOzRc4s5g7gzC7iYTVewtGEX8OJbJNAEMQ9gm 41DhIix4ueahAyCG6DUwbp1D1IQyMpGDI1XfuRjmOOxNkWcMyYDpBBqE4O3xYutoEwGG U7JJfQsBC64SUCY0TmZ3sgbNot9IvT/2N8041jJFhwNlYue7rNZIAhfBnmnlMFWyiVCR mobg== X-Gm-Message-State: AOAM530kry1JswwUhZ9Cu7cq/wQWpXw5ur5J+N6baTcoQ5bq1e+Sa7fC azPi/oUnuvievrNy5WQiuREvSxYArFNpNg== X-Google-Smtp-Source: ABdhPJx3haQGusqf240jaJllo4LwcZU3uQ70wmnE4iUylMg2KzYshe+rihlp3LAuXOij97jlEtYgqg== X-Received: by 2002:a50:88a4:: with SMTP id d33mr5009502edd.43.1599162869463; Thu, 03 Sep 2020 12:54:29 -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 j15sm3847665eds.33.2020.09.03.12.54.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 03 Sep 2020 12:54:28 -0700 (PDT) To: Nikita Popov , Mike Schinkel Cc: John Bafford , PHP internals References: <89FF9360-609A-439F-BDBE-B3B4C141E00F@newclarity.net> Message-ID: Date: Thu, 3 Sep 2020 21:54:27 +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 19:13, Nikita Popov wrote: > > Introducing special syntax for this has costs, both in terms of language > complexity and in terms of implementation complexity. For example, > implementing this feature will make foreach (whether or not the value is > ignored) marginally slower, because we will have to explicitly distinguish > this case. (Or alternatively, we'd have to specialize and increase VM code > size -- it's not free in any case.) > Regarding the performance / complexity concern, just some possibly naive idea from a non-expert: Could this not be implemented in the compilation phase only, without changing any of the run time code? Maybe the 'void' could be compiled into an opcode sequence that still introduces a variable holding the keys. Execution remains unchanged. So the only thing that 'void' does is ask PHP to implicitly create a hidden variable in stead of the programmer explicitly creating a visible one. Ok, now just say "That's nonsense" and I will shut up. :) Regards, Dik Takken