refactoring Arr and Iter #120
Labels
Priority: High
After critical issues are fixed, these should be dealt with before any further issues.
Status: In Progress
This issue is being worked on, and has someone assigned.
Type: BC Break
A change that will result in a backward compatibility break in the public API.
Type: Enhancement
Most issues will probably ask for additions or changes.
Milestone
Arr
andIter
components are currently confusing, with some functions being pure, and other not, some returning lists, dicts, or just a value/key, or something else.The idea would be:
Iter
would contain generic array functions that operate on all iterables, and usually don't return an iterable ( e.g: Iter\first, Iter\count, Iter\contains, Iter\contains_key .. etc )Vec
should contain every function that returns a vec ( i.e list ) from bothArr
andIter
.Dict
should contain every function that returns a dict ( i.e array<Tk, Tv> ) from bothArr
andIter
Arr
component ( all functions will be move to eitherIter
,Vec
, orDict
)This also means that we lazy loaded iterators, however, i don't see that as an issue, most functions will still accept iterables, so you can provide a generate, and wrap the result in a generator your self.
However, this doesn't solve the
pure
issue, where functions are not considered pure, but after #119, we can extend the psalm plugin to make it soVec\sort($array)
considered pure, whileVec\sort($db->getUsers())
( where$db->getUsers()
returns a mutable traversal ) considered impure.The text was updated successfully, but these errors were encountered: