Next: , Previous: , Up: srfi environment-variables   [Index]


2.31.5 Issues

get-environment-variable is expected to return a “Scheme string”.

Unfortunately, many current platforms, including POSIX–like ones, do not require environment variables to be interpretable as sequences of characters. In particular, environment variables can be used to name files, and filenames on the system can amount to NULL–terminated byte vectors, which, if the Scheme program were to collect uninterpreted and pass to, say, the open call, would work just fine, but which might not represent a string in the particular encoding the program expects.

While in principle it may be desirable to provide a mechanism for accessing environment variables raw, this SRFI specifies a “string” return type because that best represents the consensus of existing implementations, and captures the semantically desirable behavior in the common case that the byte sequence is interpretable as a string.