unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: "Andy Wingo" <wingo@pobox.com>
Cc: guile-devel@gnu.org
Subject: Re: [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.7-25-g990b11c
Date: Fri, 11 Jan 2013 18:15:52 +0100	[thread overview]
Message-ID: <87k3rj3ak7.fsf@gnu.org> (raw)
In-Reply-To: <E1TtfmM-0002TY-7q@vcs.savannah.gnu.org> (Andy Wingo's message of "Fri, 11 Jan 2013 14:40:18 +0000")

"Andy Wingo" <wingo@pobox.com> skribis:

> commit f05bb8494c9636cd7a44aaf7d4e08f4b66004b6e
> Author: Andy Wingo <wingo@pobox.com>
> Date:   Thu Jan 10 22:50:27 2013 +0100
>
>     add bytevector->string and string->bytevector in new (ice-9 iconv) module
>     
>     * module/Makefile.am:
>     * module/ice-9/iconv.scm: New module implementing procedures to encode
>       and decode representations of strings as bytes.
>     
>     * test-suite/Makefile.am:
>     * test-suite/tests/iconv.test: Add tests.
>     
>     * doc/ref/api-data.texi: Add docs.

Nice, this was long overdue, I guess.  :-)

> +@node Representing Strings as Bytes
> +@subsubsection Representing Strings as Bytes

[...]

> +@deffn string->bytevector string encoding [#:conversion-strategy='error]

An optional instead of keyword argument would look nicer, IMO.

> +Encode @var{string} as a sequence of bytes.
> +
> +The string will be encoded in the character set specified by the
> +@var{encoding} string.  If the string has characters that cannot be
> +represented in the encoding, by default this procedure raises an
> +@code{encoding-error},

I think this doesn’t leave a way to know which character in STRING could
not be converted.  It would be ideal if that information could be
provided as part of the exception, as is the case with ports (tested
with ‘test-decoding-error’ in ports.test.)

> +@deffn bytevector->string bytevector encoding 

#:conversion-strategy is missing here.

> +The Scheme interface to this function is @code{encode-string}, from the

string->bytevector

> +The Scheme interface to this function is @code{decode-string}.

bytevector->string

> +(define-module (ice-9 iconv)
> +  #:use-module (rnrs bytevectors)
> +  #:use-module (ice-9 binary-ports)
> +  #:use-module ((ice-9 rdelim) #:select (read-delimited))
> +  #:export (string->bytevector
> +            bytevector->string
> +            call-with-encoded-output-string))

Not a single docstring.  Now I feel ashamed when asking Nala to add
docstrings.  ;-)

Thanks!

Ludo’.



  parent reply	other threads:[~2013-01-11 17:15 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <E1TtfmM-0002TY-7q@vcs.savannah.gnu.org>
2013-01-11 16:53 ` ‘http-get*’ and all that Ludovic Courtès
2013-01-11 18:49   ` Andy Wingo
2013-01-11 23:30     ` Ludovic Courtès
2013-01-12  4:09     ` Daniel Hartwig
2013-01-21 21:15       ` Andy Wingo
2013-01-11 17:15 ` Ludovic Courtès [this message]
2013-01-11 20:28   ` [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.7-25-g990b11c Andy Wingo
2013-01-11 23:39     ` Ludovic Courtès
2013-01-12 15:17       ` Mark H Weaver
2013-01-12 20:34         ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k3rj3ak7.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=guile-devel@gnu.org \
    --cc=wingo@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).