emacs-devel
[Top][All Lists]
Advanced

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

Re: declare function/macro private


From: Arthur Miller
Subject: Re: declare function/macro private
Date: Mon, 07 Jun 2021 03:37:03 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

"Paul W. Rankin" via "Emacs development discussions."
<emacs-devel@gnu.org> writes:

>> On 7 Jun 2021, at 6:12 am, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
>> 
>> Tassilo Horn [2021-06-06 20:12:49] wrote:
>>> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>>>> 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").
>>> 
>>> If my package was structured like
>>> 
>>>  foo.el
>>>  foo-search.el
>>>  foo-parse.el
>>> 
>>> I'd find it quite natural to name a private function in foo-search.el
>>> `foo-search--do-stuff'.  Of course, it's ok if my `foo-base-do-stuff'
>>> function from foo.el calls it but it would trigger a warning with your
>>> approach because the "library" would be foo-search, no?
>> 
>> Indeed, the idea is that you'd have to use foo--search-do-stuff for
>> those functions which are private to your foo package but not to
>> foo-search.el, whereas you'd use foo-search--do-stuff for functions
>> which are not only private to your package but even private to
>> foo-search.el.
>
> If there is a lake with a bunch of alligators in it, it would be a good thing 
> to put up a sign that says "Danger: No swimming, Alligators".
>
> Such a sign's sole purpose is to provide warning to people considering 
> swimming in the alligator-infested lake, it does not actually prevent them 
> from being eaten by alligators should they ignore the warning.
>
> What I'm suggesting is to put up the sign, not to figure out a way to prevent 
> alligators from eating swimmers who ignore the sign.

Isn't a '--' that sign?



reply via email to

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