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

Remove download_urls/3 #67

Merged
merged 4 commits into from
Feb 19, 2022
Merged

Remove download_urls/3 #67

merged 4 commits into from
Feb 19, 2022

Conversation

Glutexo
Copy link
Owner

@Glutexo Glutexo commented Feb 12, 2022

As mentioned in #66 (comment), enumerable traversal is a trivial concept. It does not make sense to have a separate function just to do Enum.map. It brings confusing function dichotomy and a need for guard clauses. Also it discourages from using other types of enumerables like streams.

For the function to be testable, the get_env call needed to be moved to main/0, which makes nice symmetry with http_client. Because the input_path parameter is of the same type and thus indistinguishable from a URL, it only makes sense to rename the function.

Enumerable traversal is a trivial concept. It does not make sense to
have a separate function just to do Enum.map. It brings confusing
function dichotomy and a need for guard clauses. Also it discourages
from using other types of enumerables like streams.

For the function to be testable, the get_env call needed to be moved
to main/0, which makes nice symmetry with http_client. Because the
input_path parameter is of the same type and thus indistiguishable
from a URL, it only makes sense to rename the function.
@Glutexo Glutexo requested a review from nappex February 12, 2022 22:08
@Glutexo Glutexo self-assigned this Feb 12, 2022
@Glutexo
Copy link
Owner Author

Glutexo commented Feb 12, 2022

Extracted the get_env move to #68. I’d review and merge that Pull Request first before getting back to this one.

Reverted the get_env move to minimize the amount of changes. Used
Enum.map in the malfunctioning “download URLs from the input file”
test to at least make it still download all the URLs.
@Glutexo
Copy link
Owner Author

Glutexo commented Feb 12, 2022

Reverted the get_env move to minimize the amount of changes. Used Enum.map in the malfunctioning “download URLs from the input file” test to at least make it still download all the URLs.

@Glutexo
Copy link
Owner Author

Glutexo commented Feb 13, 2022

Merged current elixir and resolved conflicts.

Copy link
Owner Author

@Glutexo Glutexo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this even less and less. I think it only exposes flaws with the design. Hopefully Streams (begun in #66) and default values (begun in #65) will help.

lib/onigumo.ex Show resolved Hide resolved
test/onigumo_test.exs Outdated Show resolved Hide resolved
@Glutexo
Copy link
Owner Author

Glutexo commented Feb 13, 2022

May become better after #70 is resolved.

@Glutexo
Copy link
Owner Author

Glutexo commented Feb 13, 2022

Merging current elixir, resolved conflicts. The Pull Request is now smaller as it does not require changes to the non-working test. Maybe it’s not that bad in the end.

@Glutexo Glutexo changed the title Remove download/3 with urls as list Remove download_urls/3 Feb 13, 2022
@nappex nappex merged commit b73c7a7 into elixir Feb 19, 2022
@nappex nappex deleted the remove-download-urls branch February 19, 2022 19:19
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