Re: Variadic is_*() functions

From: Date: Mon, 11 Feb 2019 18:15:33 +0000
Subject: Re: Variadic is_*() functions
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-104350@lists.php.net to get a copy of this message
On Mon, Feb 11, 2019 at 9:59 AM Levi Morrison <levim@php.net> wrote: > My position is the same: pushing the variadic behavior into the > functions means that each function needs to pick || or > && > behavior, both of which are useful. > Additionally, I recall from that thread (or a similar one on the same topic) some pushback on isset() even having behavior like this. That it should be considered a mistake. Not saying I agree with going so far as to call it a mistake, but it does seem to have been an less than ideal choice. > I would rather see more > descriptive function names, such as all_of or > any_of: > The feels like your C++ experience talking. :D I do agree though, I think this model gives much more power and flexibility, I'd also favor such functions taking iterables (as you show in your examples) over variadic signatures (as shown in some replies) because this allows the short-circuiting to halt generators early as well. > These do not need to be part of PHP core, but perhaps they could be. > My preference is for the community to build what they want in userspace, then worry about teaching the engine to optimize the pattern when it sees it. -Sara

« previous php.internals (#104350) next »