Restrict vector arg eltype of read/copyuntil to UInt8 #58019
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The previous implementation of
copyuntil
did not document what the vector delimiter could be, but the implementation allowed it to be a vector of anything. This laxness has the following problems:It's semantically dubious to read until the first T in an IO, when IOs are generally conceptualized to contain bytes, and not Ts. This seems to suggest a notion of an IO "containing" T's instead of bytes (which is a different thing from merely being able to read T's from the IO).
The implementation is buggy, or at least has highly surprising consequences. For example:
These bugs are fundamental to the current implementation, and it's difficult to fix them.
readeach
. It's difficult to make this generically efficient for arbitrary T.We could also support
AbstractVector{<:AbstractChar}
by converting it toString
, internally. But I wouldn't support this. It's too messy to have one function do everything, and the user is best served having to construct the string / vector themselves.Closes #51724