Subject: bug#14109: No code for 'bytevector->string' and 'string->bytevector'

From: Ian Price <[email-masked]>
Date: Mon, 01 Apr 2013 12:46:59 +0100

Nikita Karetnikov <[email-masked]> writes:

> The mentioned functions are documented [1].  However, I'll get the
> "Unbound variable" error if I try to import them:
>
> scheme@(guile-user)> ,use (rnrs io ports) 
> scheme@(guile-user)> string->bytevector
> ;;; <unknown-location>: warning: possibly unbound variable `string->bytevector'
> ERROR: In procedure #<procedure 8ab8bc0 ()>:
> ERROR: In procedure module-lookup: Unbound variable: string->bytevector

Even if they were available, it wouldn't do you much good, because the
general transcoder functionality on ports isn't implemented.

e.g.
scheme@(guile−user)> (open-bytevector-input-port
                       (string->utf8 "foobarbaz")
                       (make-transcoder (utf-8-codec)))
GNU Guile: warning: transcoders not implemented
$5 = #<input: r6rs−bytevector−input−port ae46b40>

Maybe we could stub these, since they are mentioned in the info file[0],
and warn about them not being implemented like we do e.g. with
open-bytevector-input-port.

For the moment, the (rnrs bytevectors) module has string->utf8,
string->utf16, and string->utf32 which are implemented. Though, this
doesn't let you specify eol-style or handling-mode.

0. This documentation is lifted straight from the R6RS (modulo
formatting).
-- 
Ian Price -- shift-reset.com

"Programming is like pinball. The reward for doing it well is
the opportunity to do it again" - from "The Wizardy Compiled"