bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Simon Josefsson via Gnulib discussion list <bug-gnulib@gnu.org>
To: Bruno Haible <bruno@clisp.org>
Cc: bug-gnulib@gnu.org
Subject: Re: RFC: add a string-desc module
Date: Mon, 27 Mar 2023 12:15:47 +0200	[thread overview]
Message-ID: <87cz4uijos.fsf@kaka.sjd.se> (raw)
In-Reply-To: <9740540.4vTCxPXJkl@nimes> (Bruno Haible's message of "Fri, 24 Mar 2023 22:50:17 +0100")

[-- Attachment #1: Type: text/plain, Size: 1132 bytes --]

Bruno Haible <bruno@clisp.org> writes:

>   struct
>   {
>     size_t nbytes;
>     char * data;
>   }
>
> I propose to add a module that adds such a type, together with elementary
> functions that work on them.

I think this is a useful contribution, however I see two deal-breakers
for having it in gnulib -- both related to use in libraries.  I think
string helpers types/functions like this is useful not only in
applications but also in libraries.  Thus:

 1) License - there really isn't much novelty here, how about making
 this public domain or LGPLv2+?

 2) Applicability to use in a library - using x*alloc and abort is
 frowned upon in libraries.  Libraries should return error codes on
 expected errors (and I argue memory allocation failure is an expected
 error), and not cause application exits.

What do you think?

One way to resolve 2) is to have two variants of this functionality: one
low-level variant that doesn't abort the application on errors, and one
high-level variant that behaves like your implementation.  The
high-level variant could depend on the low-level variant, but that's not
essential.

/Simon

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 255 bytes --]

  parent reply	other threads:[~2023-03-27 10:16 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-24 21:50 RFC: add a string-desc module Bruno Haible
2023-03-24 22:32 ` Paul Eggert
2023-03-25 11:39   ` Bruno Haible
2023-03-24 23:20 ` Jeffrey Walton
2023-03-25  6:25   ` Vivien Kraus
2023-03-25 11:49   ` Bruno Haible
2023-03-25 15:51     ` Paul Eggert
2023-03-28 22:40       ` Bruno Haible
2023-03-25  6:21 ` Vivien Kraus
2023-03-25 11:56   ` Bruno Haible
2023-03-27 10:15 ` Simon Josefsson via Gnulib discussion list [this message]
2023-03-28 22:49   ` Bruno Haible

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://lists.gnu.org/mailman/listinfo/bug-gnulib

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

  git send-email \
    --in-reply-to=87cz4uijos.fsf@kaka.sjd.se \
    --to=bug-gnulib@gnu.org \
    --cc=bruno@clisp.org \
    --cc=simon@josefsson.org \
    /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).