unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Philipp Stephani <p.stephani2@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Emacs developers <emacs-devel@gnu.org>
Subject: Re: Oddities with dynamic modules
Date: Thu, 21 Mar 2019 21:12:05 +0100	[thread overview]
Message-ID: <CAArVCkQ7dZ=tL015XRpoUQfS81JJGr2fHhLZ_Lw-=92Ag=t6-A@mail.gmail.com> (raw)
In-Reply-To: <83tvhal45r.fsf@gnu.org>

Am Mo., 11. Feb. 2019 um 16:46 Uhr schrieb Eli Zaretskii <eliz@gnu.org>:
>
> > From: Philipp Stephani <p.stephani2@gmail.com>
> > Date: Sun, 10 Feb 2019 21:23:18 +0100
> > Cc: Emacs developers <emacs-devel@gnu.org>
> >
> > >  . Using 'funcall' is unnecessarily cumbersome, because the function
> > >    to be called is passed as an 'emacs_value'.  Why don't we have a
> > >    variant that just accepts a name of a Lisp-callable function as a C
> > >    string?
> >
> > Convenience is not a design goal of the module API. The primary design
> > goals are robustness, stability, simplicity, and minimalism.
>
> I thought simplicity and convenience of use tramps simplicity of the
> implementation, so it is strange to read arguments to the contrary.

Simplicity tends to be the opposite of convenience. Interface
simplicity definitely trumps convenience and implementation
simplicity.

>
> > >  . Why does 'intern' only handle pure ASCII symbol names?  It's not
> > >    like supporting non-ASCII names is hard.
> >
> > Unfortunately it is, due to Emacs underspecifying encoding. If we can
> > manage to write an 'intern' function that accepts UTF-8 strings and
> > only UTF-8 strings, I'm all for it.
>
> What are the problems you have in mind?  After all, this is already
> possible by means of 2 more function calls, as the example in the
> manual shows.  Are there any problems to do the same under the hood,
> instead of requiring users to do that explicitly in their module code?

If users want to have a truly generic "intern" function, they need to
do some legwork anyway because the signature of the "intern"
environment function doesn't allow embedded null bytes. It's also
unclear how non-Unicode symbols should be represented (if at all).
Given that almost all uses of "intern" will use ASCII symbols, it's
fine to restrict the API in this way. I've provided an example for a
wrapper function that allows at least interning of arbitrary Unicode
strings: https://phst.eu/emacs-modules#intern.

>
> > >  . I could understand why equality predicates are not provided in the
> > >    API, but I don't understand why we do provide 'eq' there.  Is it
> > >    that much more important than the other predicates?
> >
> > Yes, it represents a fundamental property of objects.
>
> How is that relevant?  Equality predicates are used very frequently
> when dealing with Lisp objects; 'eq' is not different from others in
> that respect.

I don't recollect the reasoning, but Daniel stated that "eq" is
strictly necessary, so you might want to ask him.

>
> > > IOW, if the API was supposed to be minimal, it looks like it isn't;
> > > and if it wasn't supposed to be minimal, then some important/popular
> > > functions are strangely missing, for reasons I couldn't wrap my head
> > > around.
> >
> > It is *mostly* minimal. A *completely* minimal API would not even have
> > integer and floating-point conversion functions, as those can be
> > written using the string functions. But that would be far less simple
> > and robust.
> > "eq" and "is_not_nil" are special in that they implement access to
> > fundamental object properties and can't fail, so they are fundamental
> > enough to deserve an entry in the module table.
>
> I cannot follow this reasoning, sorry.  It sounds like you are saying
> that the decision what to implement and what not justifies itself
> because it's there.  All I can say is that as someone who wrote a
> couple of lines of code in Emacs, the stuff that is in the API and the
> omissions look quite arbitrary to me.

Please see Daniel's original reasoning for the design. I'm not
claiming perfection for the module API, but it definitely strikes a
very good balance between minimalism and robustness.

>
> > The best source to answer the "why" questions is still the original
> > design document:
> > https://lists.gnu.org/archive/html/emacs-devel/2015-02/msg00960.html
>
> Which part(s) of that long document answer these questions, please?

Mostly the first sentence "We want an ABI powerful enough to let C
modules interact with Emacs, but decoupled enough to let the Emacs
core evolve independently."



  parent reply	other threads:[~2019-03-21 20:12 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-11 18:12 Oddities with dynamic modules Eli Zaretskii
2018-10-12 14:29 ` Kaushal Modi
2019-02-10 20:23 ` Philipp Stephani
2019-02-11 15:45   ` Eli Zaretskii
2019-02-11 16:04     ` Yuri Khan
2019-03-21 20:04       ` Philipp Stephani
2019-03-21 20:17         ` Eli Zaretskii
2019-03-21 20:32           ` Philipp Stephani
2019-03-21 20:46             ` Eli Zaretskii
2019-03-21 20:51               ` Philipp Stephani
2019-03-21 20:12     ` Philipp Stephani [this message]
2019-03-21 20:25       ` Eli Zaretskii
2019-03-21 20:34         ` Philipp Stephani
2019-03-21 20:51           ` Eli Zaretskii
2019-03-21 20:58             ` Philipp Stephani
2019-03-22  1:26               ` creating unibyte strings (was: Oddities with dynamic modules) Stefan Monnier
2019-03-22  7:41                 ` Eli Zaretskii
2019-03-22 12:33                   ` creating unibyte strings Stefan Monnier
2019-03-22 13:27                     ` Eli Zaretskii
2019-03-22 14:23                       ` Stefan Monnier
2019-03-22 15:11                         ` Eli Zaretskii
2019-03-22 15:37                           ` Stefan Monnier
2019-03-22 15:54                             ` Eli Zaretskii
2019-03-24 14:51                           ` Elias Mårtenson
2019-03-24 17:10                             ` Eli Zaretskii
2019-03-25  1:47                               ` Elias Mårtenson
2019-03-25  3:41                                 ` Eli Zaretskii
2019-03-26 10:23                                   ` Elias Mårtenson
2019-03-26 11:12                                     ` Stefan Monnier
2019-03-22  8:20               ` Oddities with dynamic modules Eli Zaretskii

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/emacs/

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

  git send-email \
    --in-reply-to='CAArVCkQ7dZ=tL015XRpoUQfS81JJGr2fHhLZ_Lw-=92Ag=t6-A@mail.gmail.com' \
    --to=p.stephani2@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@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.
Code repositories for project(s) associated with this public inbox

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

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).