This stems from some discussion I've had on the stb_image bindings: https://gitlab.com/define-private-public/stb_image-Nim/issues/4#note_40535183
I'd like some discussion on the use of the string datatype for non-text data. I.e. using `string` as a buffer for binary data.
It's always been my impression that if a language/API provides a string datatype, that strings should only be used for text data; e.g. Qt's QString and QByteArray objects. strings typically have the notion of being data that is mean for humans to read. Where an explicit byte array should be used for non text data (e.g. image data). Even though under the hood (most of the time) there is a char *.
In the issue ticket I linked, Eduardo Bart mentioned that int the Nim codebase that string is also used as a buffer (instead of a seq[uint8]), e.g. readFile() and writeFile(). Where even the data those procs could be returning binary and not text.
How do others here feel about this?
In the issue ticket I linked, Eduardo Bart mentioned that int the Nim codebase that string is also used as a buffer (instead of a seq[uint8]), e.g. readFile() and writeFile(). Where even the data those procs could be returning binary and not text.
That is correct. But in the longer term we'll be forced to use seq[byte] more and more. The reason? Often the serialization format (JSON) distinguishes between Unicode text and bytes.