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

RFC: Deprecate findfirst on I/O buffers #26600

Merged
merged 1 commit into from
Mar 26, 2018
Merged

RFC: Deprecate findfirst on I/O buffers #26600

merged 1 commit into from
Mar 26, 2018

Conversation

nalimilan
Copy link
Member

These two methods are exceptions in the API as we generally do not support find* for non-indexable collections. occursin and readuntil are replacements for most typical cases (but not all).

Possible counter-arguments to this change:

  • IOBuffer is special since even if it's not indexable, it supports position: it could make sense to look for the position of delim
  • the deprecation does not cover the case where you really want to know the position of delim

These two methods are exceptions in the API as we generally do not support find* for non-indexable collections.
occursin and readuntil are replacements for most typical cases (but not all).
@nalimilan nalimilan added io Involving the I/O subsystem: libuv, read, write, etc. search & find The find* family of functions deprecation This change introduces or involves a deprecation labels Mar 23, 2018
@@ -1565,6 +1562,14 @@ end
@deprecate ucfirst uppercasefirst
@deprecate lcfirst lowercasefirst

function search(buf::IOBuffer, delim::UInt8)
Copy link
Member

Choose a reason for hiding this comment

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

This should be for GenericIOBuffer.

Copy link
Member

Choose a reason for hiding this comment

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

...with the more generic implementation of course. Otherwise it seems we're missing a deprecation for search(::GenericIOBuffer, ...

Copy link
Member Author

Choose a reason for hiding this comment

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

GenericIOBuffer isn't exported, so is it really worth having a deprecation?

@JeffBezanson
Copy link
Member

Another problem with these findfirst methods is that they didn't check whether the buffer is seekable; yet another reason to make this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deprecation This change introduces or involves a deprecation io Involving the I/O subsystem: libuv, read, write, etc. search & find The find* family of functions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants