GNU bug report logs -
#23486
25.0.93; Modules: features missing from make_function
Previous Next
Reported by: Philipp Stephani <p.stephani2 <at> gmail.com>
Date: Mon, 9 May 2016 16:39:02 UTC
Severity: normal
Tags: moreinfo
Found in version 25.0.93
Fixed in version 28.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
Message #11 received at 23486 <at> debbugs.gnu.org (full text, mbox):
Philipp Stephani <p.stephani2 <at> gmail.com> writes:
> emacs_env::make_function lacks the following features supported by
> `defun':
>
> 1. Functions with both optional and rest arguments.
> 2. Specification of parameter names.
> 3. Integration with `help-function-arglist'.
> 4. Specification of interactive forms.
> 5. Specification of declare forms.
> 6. Docstrings containing null or non-Unicode characters.
>
> (6) is probably rather unimportant. (5) is probably not implementable
> (would require wrapping `defun', not `lambda'). (1)–(4) are more severe
> and quite limit the usefulness of make_function right now; for a
> truly generic `defun'-like construct one currently has to eval a `defun'
> form wrapping another function.
Shouldn't modules be providing a DEFUN-like construct instead? That is,
I thought the idea of modules was to enable writing primitive
subroutines.
>
> To solve (1)–(3), I'd propose replacing the "arity" arguments with a
> true arglist specification. This could either be at the C level, e.g.
>
> ptrdiff_t num_mandatory_args, char** mandatory_arg_names,
> ptrdiff_t num_optional_args, char** optional_arg_names,
> char* rest_arg_name
>
> or by requiring to pass a Lisp argument list.
>
> To solve (4) I'd propose to pass another value for the interactive form,
> probably as emacs_value* (to support non-interactive functions).
>
> As an alternative, if people feel this would require too many
> parameters, I'd propose reverting the change that adds the documentation
> string. A docstring without arglist is not very useful. We could also
> remove the arity parameters and have the C function check the arity
> itself.
I think adding "(fn ARG1 ARG2...)" to the docstring would solve (1)-(3).
What's lacking is a way to add this automagically like DEFUN does. And
getting the parameters in C variables like DEFUN would also be nice.
This bug report was last modified 4 years and 163 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.