Re: Re: Straw poll: Naming for `*any()` and `*all()` on iterables

From: Date: Sun, 20 Dec 2020 23:56:29 +0000
Subject: Re: Re: Straw poll: Naming for `*any()` and `*all()` on iterables
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-112570@lists.php.net to get a copy of this message
Hi Mark Randall, > These functions make sense. However I think we need to give renewed > consideration to: > > $itr->all(); > $itr->some(...); That wouldn't help for arrays, which would be the most common use case - I don't remember seeing an RFC for https://github.com/nikic/scalar_objects and that is a much larger language change. This also wouldn't help if I wanted something that could be used on any Traversable. Currently, there's no support for default methods for interfaces such as Iterator/IteratorAggregate - I think I saw some discussion of that. (e.g. to check for any()/all() on generators, user-defined classes, etc) Backwards compatibility of method signatures with the same names that were written before default methods were added would be a concern, though. (https://docs.oracle.com/javase/tutorial/java/IandI/defaultmethods.html) Regards, - Tyson

« previous php.internals (#112570) next »