emacs-devel
[Top][All Lists]
Advanced

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

Re: declare function/macro private


From: Stefan Monnier
Subject: Re: declare function/macro private
Date: Sun, 06 Jun 2021 14:05:30 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

> Of course there's already the convention of prefix--my-private-function, but

What would be the difference between this convention and your proposed 
declaration?

> my thinking here is that a program could declare a function/macro as
> private, then the compiler could signal a warning/error if that function
> appeared in a library outside the library it was defined and
> declared private.

We don't have a definition for "library", sadly.

I think the "--" convention actually includes an extra information
compared to yours which could be useful here: we could warn for uses of
"foo--" if and only if the use appears in something whose name doesn't
start with "foo-".

IOW, use the string before the "--" as the definition of the "library"
(so that would support cases where a library is spread over several
files, as well as the case where a single file contains "internal
libraries").

Of course, if we enable such a warning now, we'll get a fairly large
number of warnings, I think ;-)

Another advantage of the "--" convention is that you don't need to load
the definition of that function in order to discover that it's private.


        Stefan




reply via email to

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