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

seekuntil function to mirror readuntil #36132

Open
non-Jedi opened this issue Jun 3, 2020 · 6 comments · May be fixed by #36160
Open

seekuntil function to mirror readuntil #36132

non-Jedi opened this issue Jun 3, 2020 · 6 comments · May be fixed by #36160
Labels
docs This change adds or pertains to documentation feature Indicates new feature / enhancement requests

Comments

@non-Jedi
Copy link
Contributor

non-Jedi commented Jun 3, 2020

I often find myself wishing for a seekuntil function that behaves like readuntil but does not allocate a string. It seems like an obviously useful function for lots of purposes. Is there interest in including such a function in Base?

@StefanKarpinski
Copy link
Member

Yes, that does make sense.

@non-Jedi
Copy link
Contributor Author

non-Jedi commented Jun 4, 2020

@non-Jedi
Copy link
Contributor Author

non-Jedi commented Jun 4, 2020

Turns out this does already exist which I didn't find until I had already mostly implemented this. It's skipchars. I'm leaving this issue open with the actionable item being to add a link in the readuntil docstring to skipchars.

@StefanKarpinski
Copy link
Member

And/or provide skipuntil as a better name for skipchars, which is pretty non-obvious.

@non-Jedi
Copy link
Contributor Author

non-Jedi commented Jun 4, 2020

Is there another example in Base where multiple aliases are provided to the same function? I'm not exactly sure what doing so should look like in docstrings and generated documentation.

@StefanKarpinski
Copy link
Member

We have done so occasionally when the name for something was really bad. We would deprecate skipchars for skipuntil since deprecations are off by default now, which would have the effect that anyone who asks for deprecation warnings would get the message to change the name.

non-Jedi added a commit to non-Jedi/julia that referenced this issue Jun 4, 2020
Because of the check for eof on each iteration, this will not be as
efficient as readuntil or skipchars, but it is still sometimes useful,
and saves boilerplate versus a while(!eof(io)) read(io, T) loop. The
function signature is patterned after the read(io, T) function
signature.

Prompted by JuliaLang#36132 but does not close JuliaLang#36132

I am open to better/clearer names for this function.
non-Jedi added a commit to non-Jedi/julia that referenced this issue Jun 4, 2020
non-Jedi added a commit to non-Jedi/julia that referenced this issue Jun 4, 2020
Per discussion in JuliaLang#36132, I believe this name is much clearer. Another
option is "seekuntil".

Closes JuliaLang#36132
non-Jedi added a commit to non-Jedi/julia that referenced this issue Jun 4, 2020
This saves boilerplate versus a while !eof(io); read(io, T) loop. The
function signature is patterned after the read(io, T) function
signature.

Prompted by JuliaLang#36132 but does not close JuliaLang#36132

I am open to better/clearer names for this function.
non-Jedi added a commit to non-Jedi/julia that referenced this issue Jun 5, 2020
Closes JuliaLang#36132

The name skipchars does not clearly communicate the functionality
available.

Tests for skipchars were left in place to ensure the @deprecate macro
correctly converted those calls to using skipuntil.
non-Jedi added a commit to non-Jedi/julia that referenced this issue Jun 5, 2020
Closes JuliaLang#36132

The name skipchars does not clearly communicate the functionality
available.

Tests for skipchars were left in place to ensure the @deprecate macro
correctly converted those calls to using skipuntil.
non-Jedi added a commit to non-Jedi/julia that referenced this issue Jun 5, 2020
Closes JuliaLang#36132

The name skipchars does not clearly communicate the functionality
available.

Tests for skipchars were left in place to ensure the @deprecate macro
correctly converted those calls to using skipuntil.
non-Jedi added a commit to non-Jedi/julia that referenced this issue Jun 8, 2020
Closes JuliaLang#36132

The name skipchars does not clearly communicate the functionality
available.

Tests for skipchars were left in place to ensure the @deprecate macro
correctly converted those calls to using skipuntil. Although CI only
runs tests with --depwarn=error, I have confirmed these tests pass
successfully with --depwarn=yes/no locally.
@brenhinkeller brenhinkeller added feature Indicates new feature / enhancement requests docs This change adds or pertains to documentation labels Nov 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs This change adds or pertains to documentation feature Indicates new feature / enhancement requests
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants