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

collection: remove static factory methods from contract #78

Merged
merged 1 commit into from
May 11, 2021
Merged

collection: remove static factory methods from contract #78

merged 1 commit into from
May 11, 2021

Conversation

Lctrs
Copy link
Contributor

@Lctrs Lctrs commented May 11, 2021

Those static factory methods are tied to how the default implementation works, and makes it hard to provide an alternative implementation.

For exemple, I have some use cases where I already know the number of items in the iterable, and I would like to pass it to the alternative implementation to avoid calling iterator_count()

Those static factory methods are tied to how the default implementation works, and makes it hard to provide an alternative implementation.

For exemple, I have some use cases where I already know the number of items in the iterable, and I would like to pass it to the alternative implementation to avoid calling `iterator_count()`
@drupol
Copy link
Collaborator

drupol commented May 11, 2021

Hi,

Thanks for your contribution.

Changing stuff in the interface is often a backward incompatible change.

I'm usually a bit reluctant to include this change but in this particular case, it's fine because those methods are basically the static constructors and we will never call them from the interface (CollectionInterface::fromIterable).

Give me a bit of time to think about it.

In the meantime, could you please provide a code example of what you're trying to do?

Thanks.

@drupol
Copy link
Collaborator

drupol commented May 11, 2021

After our interesting discussion on Slack, we came to the conclusion that this PR is definitely valid.

Thanks!

@drupol drupol merged commit dbd32ca into loophp:master May 11, 2021
@Lctrs
Copy link
Contributor Author

Lctrs commented May 11, 2021

Thank you !

@Lctrs Lctrs deleted the feature/factory-methods branch May 11, 2021 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants