Warning: Some posts on this platform may contain adult material intended for mature audiences only. Viewer discretion is advised. By clicking ‘Continue’, you confirm that you are 18 years or older and consent to viewing explicit content.
I might be already exposing myself as an emacs user, but I think Lisp naming convention is pretty reasonable. I use it in other languages as far as their language rules allow me
if a variable or function is a predicate (as in if it tests if something is true or not), append p or _p/-p
variables and functions both have lisp case variable-name-here. Sub for _ in languages that dont allow - in names
unused or unexposed variables are prefixed _ .
top level packages get naming rights. So if I’m making cool-package then variables or functions that are specific to it are cool-package-variable (especially if it is exposed to other packages). cool-package/variable is also good if allowed.
otherwise, separate namespaces with /. So there’s main-function and my/main-function. If / is reserved, then I assume the language has a way of segmenting namespaces already and just default to that since _ or - would get ambiguous here.
I might be already exposing myself as an emacs user, but I think Lisp naming convention is pretty reasonable. I use it in other languages as far as their language rules allow me
if a variable or function is a predicate (as in if it tests if something is true or not), append
p
or_p
/-p
variables and functions both have lisp case
variable-name-here
. Sub for_
in languages that dont allow-
in namesunused or unexposed variables are prefixed
_
.top level packages get naming rights. So if I’m making
cool-package
then variables or functions that are specific to it arecool-package-variable
(especially if it is exposed to other packages).cool-package/variable
is also good if allowed.otherwise, separate namespaces with
/
. So there’smain-function
andmy/main-function
. If/
is reserved, then I assume the language has a way of segmenting namespaces already and just default to that since_
or-
would get ambiguous here.See the rest here: https://github.com/bbatsov/emacs-lisp-style-guide