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

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to