all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Do we need C's extern in Emacs Lisp?
@ 2022-03-29 17:45 Alan Mackenzie
  2022-03-29 21:09 ` Stefan Monnier
  2022-03-31  4:26 ` Richard Stallman
  0 siblings, 2 replies; 5+ messages in thread
From: Alan Mackenzie @ 2022-03-29 17:45 UTC (permalink / raw)
  To: emacs-devel

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



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-03-31 21:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-29 17:45 Do we need C's extern in Emacs Lisp? Alan Mackenzie
2022-03-29 21:09 ` Stefan Monnier
2022-03-31 20:59   ` Alan Mackenzie
2022-03-31 21:16     ` Stefan Monnier
2022-03-31  4:26 ` Richard Stallman

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.