emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Do we need C's extern in Emacs Lisp?


From: Alan Mackenzie
Subject: Do we need C's extern in Emacs Lisp?
Date: Tue, 29 Mar 2022 17:45:57 +0000

Hello, Emacs.

This point came up in discussion with Lars over an old bug report.

In C, there is the keyword extern which means "defined somewhere else".
For a function, an example is

    extern foo (int bar);

, and for a variable, something like

    extern int foo;

..  This keyword has the property that the extern object can be defined
anywhere else in the program, and the object can be used in the current C
file without causing any errors or warnings.

Currently we do not have any equivalent in Lisp.  For example, if

    (defvar foo)

is in a Lisp file, then subsequent use of foo will generate an unknown
variable warning.

For example(2), if in the Lisp file there is

    (declare-function foo nil)

, this generates a warning when the function foo is later defined.

I think it would be useful to have some sort of "extern" facility in our
Lisp.

What do other people think?

-- 
Alan Mackenzie (Nuremberg, Germany).



reply via email to

[Prev in Thread] Current Thread [Next in Thread]