Skip to content

Semantics of position #57639

@jakobnissen

Description

@jakobnissen

The semantics of position are not clear, and depending on the choices, some implementations may be buggy. In particular:

  1. Must position be an integer, or can it be a custom struct?
  2. When having an IO struct that represents a compressed file being decompressed, is the position the position of the underlying file, or the decompressed data?
  3. Must position be monotonically increasing as the IO reads/writes? Or, are IOs allowed to destroy previously read data, such that position may decrease?
  4. Is position meaningful for non-seekable IOs?

The following behaviour may or may not be buggy

buf = PipeBuffer(; maxsize=8)
write(buf, "abcdefgh")
@assert position(buf) == 0
read(buf, 2)
@assert position(buf) == 2
write(buf, 2)
@assert position(buf) == 0

Metadata

Metadata

Assignees

No one assigned

    Labels

    ioInvolving the I/O subsystem: libuv, read, write, etc.needs decisionA decision on this change is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions