Summary
builtin_write_file in io.py always opens files with encoding='utf-8' — there is no binary write mode. Scripts that need to write binary data (compiled bytecode, image files, protocol buffers) cannot do so via std:fs.
Additionally, there is no byte array type in Nodus. Binary data from subprocess.stdout is a string (decoded), and there is no way to construct or manipulate raw byte sequences from within a script.
Impact
This is a Stage 3 bootstrap gap: to write a Nodus compiler in Nodus itself, the compiler must be able to write compiled bytecode files. Without binary write and a byte array type, this is not possible.
Fix direction (v5)
- Add
write_file_bytes(path, bytes_list) builtin that opens with 'wb' mode and writes a list of integers (0–255) as bytes
- Add
read_file_bytes(path) that reads a file in binary mode and returns a list of integers
- Consider a
Bytes value type for more ergonomic binary handling
As a stopgap, std:subprocess can write binary files by invoking system tools, but that's a workaround, not a solution.
Affected versions
v4.0.0 (current when filed). Noted in Runtime Readiness Audit bootstrap table as MISSING.
Summary
builtin_write_fileinio.pyalways opens files withencoding='utf-8'— there is no binary write mode. Scripts that need to write binary data (compiled bytecode, image files, protocol buffers) cannot do so viastd:fs.Additionally, there is no byte array type in Nodus. Binary data from
subprocess.stdoutis a string (decoded), and there is no way to construct or manipulate raw byte sequences from within a script.Impact
This is a Stage 3 bootstrap gap: to write a Nodus compiler in Nodus itself, the compiler must be able to write compiled bytecode files. Without binary write and a byte array type, this is not possible.
Fix direction (v5)
write_file_bytes(path, bytes_list)builtin that opens with'wb'mode and writes a list of integers (0–255) as bytesread_file_bytes(path)that reads a file in binary mode and returns a list of integersBytesvalue type for more ergonomic binary handlingAs a stopgap,
std:subprocesscan write binary files by invoking system tools, but that's a workaround, not a solution.Affected versions
v4.0.0 (current when filed). Noted in Runtime Readiness Audit bootstrap table as MISSING.