The five primitive string types correspond to cases where a C representation matches MzScheme’s representation without encodings.
The form _bytes form can be used type for Scheme byte strings, which corresponds to C’s char* type. In addition to translating byte strings, #f corresponds to the NULL pointer.
A type for Scheme’s native Unicode strings, which are in UCS-4 format. These correspond to the C mzchar* type used by PLT Scheme.
Unicode strings in UTF-16 format.
Simple char* strings, corresponding to Scheme’s paths.
Simple char* strings as Scheme symbols (encoded in UTF-8). Return values using this type are interned as symbols.
Types that correspond to (character) strings on the Scheme side and char* strings on the C side. The bridge between the two requires a transformation on the content of the string. As usual, the types treat #f as NULL and vice-versa.
The _string/ucs-4 type is rarely useful when interacting with foreign code, while using _bytes is somewhat unnatural, since it forces Scheme programmers to use byte strings. Using _string/utf-8, etc., meanwhile, may prematurely commit to a particular encoding of strings as bytes. The _string type supports conversion between Scheme strings and char* strings using a parameter-determined conversion.
type : ctype?