Open
Description
I'm not sure what the precise semantics of seek
should be. Currently, it's underdefined, and I think we should exploit that the current lack of documentation (and inconsistent behaviour) gives us freedom to define seek
as we want (rather than just documenting how it actually behaves currently).
- Is the position always an integer, or can an IO define a custom indexing type e.g. to carry state?
- Should it be documented that the position must be zero-indexed?
- What should the behaviour be when seeking to a negative offset? This errors for
IOStream
, but not forIOBuffer
- What should the behaviour be when seeking to something larger than the filesize? Currently, it seeks to the end, but @vtjnash in Refactor IOBuffer code #57570 suggested it should instead behave like lseek.
- What should happen when calling
seek
on an unseekable IO? Should it be a noop or throw an error? Which error?