this post was submitted on 09 Sep 2023
1055 points (97.2% liked)
Programmer Humor
41256 readers
34 users here now
Post funny things about programming here! (Or just rant about your favourite programming language.)
Rules:
- Posts must be relevant to programming, programmers, or computer science.
- No NSFW content.
- Jokes must be in good taste. No hate speech, bigotry, etc.
founded 6 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
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
por_p/-pvariables 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-packagethen variables or functions that are specific to it arecool-package-variable(especially if it is exposed to other packages).cool-package/variableis also good if allowed.otherwise, separate namespaces with
/. So there'smain-functionandmy/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