函数名称中的双减号 (--) 约定在 Emacs Lisp 中意味着什么
我一直在阅读一些 Emacs Lisp 包,并且遇到了一些函数在库前缀之后用 -- 声明的约定,例如:
(defun eproject--combine-regexps (regexp-list)
我想知道这是否是向库声明“私有”函数的约定但到目前为止我还没有在 Emacs 编码指南中找到任何内容。
I've been reading through a number of Emacs Lisp packages and have come across the convention of some functions being declared with -- after the library prefix, e.g.:
(defun eproject--combine-regexps (regexp-list)
I'm wondering if this a convention for declaring "private" functions to the library but so far I haven't found anything in the Emacs Coding guidelines.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Emacs 不支持命名空间、包、库或模块。因此,Emacs 源使用
foo-
作为foo
库的前缀,并且在某些情况下foo--
用于应该绑定的绑定是内在的。Emacs doesn't have any support for namespaces, packages, libraries or modules. Emacs sources therefore use
foo-
as a prefix for afoo
library, and in some casesfoo--
is used for bindings that are supposed to be internal.对于 Emacs 来说,确实不存在“内部”这样的东西。但是,是的,一些程序员已经采用了这种约定来指示更内部的事物 - 这意味着实现者在更改它们时会更少(或没有)犹豫。这是让代码用户意识到这种可能的波动性的一种方式。
There is really no such thing as "internal" for Emacs. But yes, some programmers have adopted this convention to indicate things that are more internal -- meaning essentially that there will be less (or no) hesitation by implementors to change them. It's a way of letting users of the code be aware of this possible volatility.