I think we can make file IO operations be simpler than they are.
Open/close as they are now.
Read that takes in a max buffer size and returns a list of bytes (or ascii string) of up to that size.
Write that takes a list of bytes.
Seek that takes a byte position and moves the file position to that byte. Maybe an option for a relative seek.
For read and seek, we can either receive a U24 or a pair of U24, not sure which is better.
Unless there's some difference between a generic read and reading a char that I'm not aware of, we can implement it directly in Bend.
Also, we can implement read_line in Bend instead of in HVM.
I think with this we can do all the operations while commiting to the minimum set of HVM functions.
It would be nice if all the IO functions were documented somewhere.
I think we can make file IO operations be simpler than they are.
For read and seek, we can either receive a U24 or a pair of U24, not sure which is better. Unless there's some difference between a generic read and reading a char that I'm not aware of, we can implement it directly in Bend. Also, we can implement read_line in Bend instead of in HVM.
I think with this we can do all the operations while commiting to the minimum set of HVM functions.
It would be nice if all the IO functions were documented somewhere.