Does any body besides me think the following code should output an empty string? import memfiles var memSlice: MemSlice echo '"', memSlice, '"' Run
instead of the following error: /Users/dennismisener/work/Nim/test.nim(3) test /Users/dennismisener/.choosenim/toolchains/nim-2.0.8/lib/pure/memfiles.nim(420) $ /Users/dennismisener/.choosenim/toolchains/nim-2.0.8/lib/system/fatal.nim(53) sysFatag Error: unhandled exception: index out of bounds, the container is empty [IndexDefect] Error: execution of an external program failed: '/Users/dennismisener/.cache/nim/test_d/test_4F44913C0CDB58A8455A8925F2E5EF9B25FCDE0E' Run The reported code in `/lib/pure/memfiles.nim` is: proc `$`*(ms: MemSlice): string {.inline.} = ## Return a Nim string built from a MemSlice. result.setLen(ms.size) copyMem(addr(result[0]), ms.data, ms.size) Run Perhaps replacing the last line with: copyMem(cast[pointer](result.cstring), ms.data, ms.size) Run would be more _forgiving_? This is appears to be triggered by trying to determine the starting address of an empty Nim string ( _unless of course bound checking is disabled_ ) I've noticed there are similar constructs throughout the Nim codebase which might also be problematic.