From: Philipp Stephani <p.stephani2@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>, emacs-devel@gnu.org
Cc: aurelien.aptel+emacs@gmail.com, tzz@lifelogs.com, dancol@dancol.org
Subject: Re: Reporting Lisp errors in dynamic modules
Date: Fri, 27 Nov 2015 16:40:23 +0000 [thread overview]
Message-ID: <CAArVCkR5EHtcF_emZRpxPgSESnEAa7qXt6tqJTSEjVOYrnSqwA@mail.gmail.com> (raw)
In-Reply-To: <83egfbsnu2.fsf@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 1745 bytes --]
Eli Zaretskii <eliz@gnu.org> schrieb am Fr., 27. Nov. 2015 um 12:07 Uhr:
> With the latest emacs-25 branch, load modules/mod-test/mod-test.so,
> then evaluate '(mod-test-sum "1" 2)'. The backtrace that pops up is
> this:
>
> Debugger entered--Lisp error: (wrong-type-argument integerp "1")
> #<subr module-call>(#<save-value <pointer 00fdab90> <unused> <unused>
> <unused>> ("1" 2))
> mod-test-sum("1" 2)
> eval((mod-test-sum "1" 2) nil)
> elisp--eval-last-sexp(nil)
> eval-last-sexp(nil)
> funcall-interactively(eval-last-sexp nil)
> call-interactively(eval-last-sexp nil nil)
> command-execute(eval-last-sexp)
>
> I believe the line with "<subr module-call>" is suboptimal, in that it
> looks alien and includes all kinds of unneeded and weirdly formatted
> data. AFAIU, the reason is that we deliberately unintern module-call.
> Should we perhaps reconsider that decision, so that the backtrace is
> in more familiar form? What exactly are the dangers of having
> module-call exposed as any other primitive?
>
- Somebody calls it with the wrong type. Right now it doesn't do any type
checking, so that would crash/be UB.
- An existing function outside of Emacs might already be called like that.
Those are really minor issues, but since module-call is unusable from Lisp
or module code anyway, I've decided to avoid them by uninterning it. If
type checking is added and the name clash issue is consider minor,
interning it is fine.
A cleaner approach would be to define module functions as separate kind of
function object. I think right now we have lists (Lisp closures and
lambdas), subrs, and bytecode objects, module functions could be a fourth
type. But that would require more thorough changes.
[-- Attachment #2: Type: text/html, Size: 2262 bytes --]
next prev parent reply other threads:[~2015-11-27 16:40 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-27 11:07 Reporting Lisp errors in dynamic modules Eli Zaretskii
2015-11-27 11:20 ` Aurélien Aptel
2015-11-27 11:46 ` Eli Zaretskii
2015-11-27 12:49 ` Aurélien Aptel
2015-11-27 12:53 ` David Kastrup
2015-11-27 14:50 ` Eli Zaretskii
2015-11-27 16:40 ` Philipp Stephani [this message]
2015-11-27 17:39 ` Eli Zaretskii
2015-11-27 18:01 ` Philipp Stephani
2015-11-27 18:11 ` Eli Zaretskii
2015-11-27 18:40 ` Philipp Stephani
2015-11-28 12:04 ` Eli Zaretskii
2015-12-03 5:00 ` Stefan Monnier
2015-12-03 11:33 ` Aurélien Aptel
2015-12-03 13:42 ` Ted Zlatanov
2015-12-03 15:37 ` Stefan Monnier
2015-12-07 19:13 ` Philipp Stephani
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=CAArVCkR5EHtcF_emZRpxPgSESnEAa7qXt6tqJTSEjVOYrnSqwA@mail.gmail.com \
--to=p.stephani2@gmail.com \
--cc=aurelien.aptel+emacs@gmail.com \
--cc=dancol@dancol.org \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=tzz@lifelogs.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.
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.