Skip to content

Rework IO

Yorick Peterse requested to merge rework-io into master

This completely reworks the IO system of Inko, using proper byte array types where necessary, instead of using an array of integers. See c5897da0 for more details.

This fixes #108 (closed)

TODO

  • Close.close should throw
  • Change the documentation of Close to indicate it's for closing files, sockets, etc, and not for disposing of regular objects
  • read should be given a required buffer argument, of type Array!(Integer). Data is read into this buffer, instead of returning a new array.
  • read should be given an optional size argument. If given, only size bytes are read, otherwise all remaining bytes are read.
  • read_string should be added, which reads up to size bytes (or all remaining ones), and returns the result as a String
  • Reading a single line should be implemented in just Inko, and the VM instructions should be removed
  • write takes a Array!(Integer), instead of a String
  • write_string takes a String
  • StringFromBytes should optionally drain the input Array. This allows for more efficient reading of data and converting it to a string, without relying on VM code.
  • Clean up std::fs::file using the object ... impl syntax
Edited by Yorick Peterse

Merge request reports