Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactoring Arr and Iter #120

Closed
azjezz opened this issue Feb 7, 2021 · 2 comments
Closed

refactoring Arr and Iter #120

azjezz opened this issue Feb 7, 2021 · 2 comments
Assignees
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

Comments

@azjezz
Copy link
Owner

azjezz commented Feb 7, 2021

Arr and Iter 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:

  1. 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 )
  2. a new component Vec should contain every function that returns a vec ( i.e list ) from both Arr and Iter.
  3. a new component Dict should contain every function that returns a dict ( i.e array<Tk, Tv> ) from both Arr and Iter
  4. deprecate Arr component ( all functions will be move to either Iter, Vec, or Dict )

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 so Vec\sort($array) considered pure, while Vec\sort($db->getUsers()) ( where $db->getUsers() returns a mutable traversal ) considered impure.

@azjezz azjezz added the Type: Enhancement Most issues will probably ask for additions or changes. label Feb 7, 2021
@azjezz azjezz self-assigned this Feb 7, 2021
@azjezz azjezz added 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. labels Feb 7, 2021
@azjezz azjezz modified the milestones: 1.2.0, 2.0.0 Feb 7, 2021
@azjezz azjezz added the Priority: High After critical issues are fixed, these should be dealt with before any further issues. label Feb 7, 2021
@azjezz
Copy link
Owner Author

azjezz commented Feb 7, 2021

deprecation will take place in 1.2, and the removal of old functions will happen in 2.0.

@azjezz azjezz modified the milestones: 1.2.0, 2.0.0 Feb 16, 2021
@azjezz
Copy link
Owner Author

azjezz commented Oct 29, 2021

done in #241

@azjezz azjezz closed this as completed Oct 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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.
Projects
None yet
Development

No branches or pull requests

1 participant