all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Stephen J. Turnbull" <stephen@xemacs.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: joakim@verona.se, emacs-devel@gnu.org
Subject: Re: FFI again
Date: Mon, 07 Oct 2013 10:41:41 +0900	[thread overview]
Message-ID: <87iox9luwa.fsf@uwakimon.sk.tsukuba.ac.jp> (raw)
In-Reply-To: <jwvd2nimkcq.fsf-monnier+emacs@gnu.org>

Stefan Monnier writes:

 > I personally don't have any experience either way.

The SXEmacs people do, though (using libffi).  Their proof-of-concept
is a simple wrapper for libcurl.  If somebody wants to push forward
with this they should ask.  Most of the other scripting languages
(Python for sure has "ctypes", Ruby has something, maybe Guile does
too) have libffi wrappers.  That experience might be useful too.

Me, I'm just going to use the SXEmacs patch (for XEmacs).  If Steve Y
is willing to sign off, that is probably a good route for Emacs to
start with (the DEFUN macro is different and I don't think ours is
FSF-assigned, but the translation is routine).

 > But I think that a good benchmark for an FFI is to make our libxml
 > and libgnutls code use it.

libxml, maybe.  libgnutls I would continue to provide a dedicated
wrapper for.  It's very tricky to get the Lisp-to-C type matching
robust in an FFI, and if there's a problem in the FFI you probably
break all existing modules by fixing it.  In the meantime, if the FFI
doesn't do *all* the checks just right (and that's very hard to do in
standard C because called libraries typically use platform-dependent
types like "int" rather than "int32", and are often pretty cavalier
about casting internally), you have a crash waiting for some
unsuspecting Lisp code.  Nevertheless, there is a lot of pressure to
avoid changing the FFI.  Better to tweak all that stuff in dedicated
code when you're dealing with security code.

 > > The routines declared in lisp.h do not form stable interface.
 > 
 > Indeed, we'd need to define a slightly more stable API.

This is awfully tricky.  The Python guys spent something like ten
years developing their ABI specification, and had the advantage of a
religious mandate for backward compatibility.  Emacs has always been
wild and woolly with respect to APIs and ABIs since they're all
internal as far as Emacs is concerned.  Even in the published Lisp
Reference backward compatibility with 3rd party programs is frequently
(as measured with decade time units) sacrificed to somebody's sense of
symmetry.  Every release of Emacs has new surprises for XEmacs and
SXEmacs.  (This isn't a complaint, it's a statement of fact.  The
point is that these surprises are much more painful for users at the
level of C code because it's not safe and because it's harder for most
of them to change.)






  parent reply	other threads:[~2013-10-07  1:41 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-05 16:11 FFI again Stefan Monnier
2013-10-05 16:24 ` joakim
2013-10-05 22:18   ` Stefan Monnier
2013-10-05 22:33     ` joakim
2013-10-06 16:39       ` Stefan Monnier
2013-10-06 16:54         ` Eli Zaretskii
2013-10-06 18:17           ` Stefan Monnier
2013-10-06 19:04             ` Eli Zaretskii
2013-10-07  1:41         ` Stephen J. Turnbull [this message]
2013-10-07  3:29           ` Stefan Monnier
2013-10-07  4:34             ` Stephen J. Turnbull
2013-10-07  4:58               ` Stefan Monnier
2013-10-07 22:14                 ` Andy Moreton
2013-10-07 22:47                   ` Stefan Monnier
2013-10-08  6:54                     ` Eli Zaretskii
2013-10-08  2:22                   ` Stephen J. Turnbull
2013-10-08  2:47                   ` Richard Stallman
2013-10-08  5:33                     ` Stephen J. Turnbull
2013-10-08  7:14                       ` Eli Zaretskii
2013-10-05 17:07 ` Eli Zaretskii
2013-10-05 23:24 ` Daniel Colascione
2013-10-06 19:19 ` Richard Stallman

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

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

  git send-email \
    --in-reply-to=87iox9luwa.fsf@uwakimon.sk.tsukuba.ac.jp \
    --to=stephen@xemacs.org \
    --cc=emacs-devel@gnu.org \
    --cc=joakim@verona.se \
    --cc=monnier@iro.umontreal.ca \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.