bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: "Marc Nieper-Wißkirchen" <marc.nieper+gnu@gmail.com>
To: bug-gnulib@gnu.org
Subject: Callbacks in the abstact data types and extra contextual data
Date: Thu, 9 Jul 2020 18:13:02 +0200	[thread overview]
Message-ID: <CAEYrNrSJCQRHiXahOhqx6NO_iP1Ys2NCQQw6nDWS=t9QGTcj-A@mail.gmail.com> (raw)

Hi,

a number of modules (like the hash module or the list module) allow
the user to specify callbacks (e.g. a comparison function).
Unfortunately, these procedures do not take a context parameter, which
can be a problem because C lacks closures.

The original qsort function in stdlib.h has the same problem. Glibs
has remedied the problem by introducing qsort_r.

It would be nice if the modules hash, list, xlist, oset, xoset, ...
are extended in a similar way. We would essentially need new
constructors, say with the '_r' suffix.

Marc


             reply	other threads:[~2020-07-09 16:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-09 16:13 Marc Nieper-Wißkirchen [this message]
2020-07-09 20:16 ` Callbacks in the abstact data types and extra contextual data Bruno Haible
2020-07-09 20:38   ` Marc Nieper-Wißkirchen
2020-07-10 18:37     ` Bruno Haible
2020-07-10 19:32       ` Marc Nieper-Wißkirchen
2020-07-10 20:40         ` 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='CAEYrNrSJCQRHiXahOhqx6NO_iP1Ys2NCQQw6nDWS=t9QGTcj-A@mail.gmail.com' \
    --to=marc.nieper+gnu@gmail.com \
    --cc=bug-gnulib@gnu.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).