Timeline for Naming convention for variable and function names
Current License: CC BY-SA 3.0
15 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
May 7, 2015 at 15:22 | history | edited | Drew | CC BY-SA 3.0 |
added 577 characters in body
|
May 6, 2015 at 14:52 | comment | added | Malabarba | (1) I'm not talking about specific pieces, I'm referring to the overall tone of the answer. When you read everything, the lesson in item 4 (which is the most important IMO) gets buried by the other stuff. Your new edit makes it better (enough for me to remove my downvote), but I still think it should say first and foremost "if don't have strong opinions, just use hyphens and lowercase" and then elaborate on the details. | |
May 6, 2015 at 14:33 | comment | added | Drew |
@Malabarba: (1) If you take pieces of my answer out of context then you can paint it anyway you like. (2) Yes, I forgot case-fold-search - I get 704. (3) The disagreement is (at least) over you should. What's important is why 99% of names are lowercase with hyphens: because (a) they can be (in particular, hyphen is allowed) and (b) they are easier to type (no shifting). That's all. It's not about fitting some mold. There is no you should (but it's not enforced). There is only it will be easier for users if you use lowercase, because they will not need to use Shift.
|
|
May 6, 2015 at 14:20 | comment | added | Malabarba |
@Drew Well, maybe we'll have to agree to disagree. To me, the answer to the "should...always" question is "Yes you should, although you're not forced". I can see that's more or less what you say on item 4, but you start by saying "there's no convention" and finish by saying "do whatever you want" which (I feel) buries item 4 to the reader. As for that 14875, that is the total number of defined symbols in vanilla emacs -q , which tells me you forgot to set case-fold-search to nil . ;-) The actual number of symbols with uppercase is 861 for me.
|
|
May 6, 2015 at 14:17 | history | edited | Drew | CC BY-SA 3.0 |
added 662 characters in body
|
May 6, 2015 at 13:38 | comment | added | Drew |
As I mentioned in a comment to another (deleted) answer: Vanilla (emacs -Q ) Emacs tells me there are 14975 symbols whose first letter is uppercase.
|
|
May 6, 2015 at 13:35 | comment | added | Drew | @Malabarba: I referred to a de facto standard, and I said that it is "used generally (which it is, 99% of the time)". What are you adding, by saying that it is used 95% of the time? The question is "should variable and function names always be lower case?" There is no answer to "should...always", beyond what is most appropriate for your use case. I made clear that "Generally, it makes sense to use all lowercase" - so much for your "he ought to be told". There is no documented convention. There is a de facto standard. And what counts is one's use case. This is Lisp. | |
May 6, 2015 at 8:55 | comment | added | Malabarba | Saying that "There is no convention wrt case for Emacs-Lisp" is almost completely wrong. There is no enforced convention, and maybe there was no convention at all 3 decades ago, but there is very much a followed convention nowadays. 95% of the defined symbols in Emacs are strictly lowercase, and the only libraries I could find that use upper-case date back to 1985. The developer is not obligated to do anything, but if the OP is asking for conventions then he ought to be told that there is one even if it is not mandatory. | |
May 3, 2015 at 18:35 | history | edited | Drew | CC BY-SA 3.0 |
added 6 characters in body
|
May 3, 2015 at 17:42 | comment | added | Dmitry | "Use whatever you want" is not a very good answer to a question about naming conventions. Especially in this case, where title-casing is almost never used. | |
May 3, 2015 at 16:37 | history | edited | Drew | CC BY-SA 3.0 |
added 532 characters in body
|
May 3, 2015 at 16:30 | comment | added | Drew |
(1) "it would be great if everyone could adapt to that style". Why? What confusion? What's the problem? Anyway, if you think you've found a problem, and you have a solution/suggestion to propose for it, then please consider using M-x report-emacs-bug or posting to [email protected] . (2) If there is a de facto standard, it is to use only lowercase, for simplicity and to avoid the kind of confusion that I'm guessing you're thinking of. But if not, just what confusion do you experience or envision if lowercase is used generally (which it is, 99% of the time)?
|
|
May 3, 2015 at 16:23 | vote | accept | Håkon Hægland | ||
May 3, 2015 at 16:18 | comment | added | Håkon Hægland |
I am not sure I agree that one should "use whatever style you want ".. I think an "official" standard like github.com/bbatsov/emacs-lisp-style-guide would be required in open source projects to avoid confusion. And then in the long run it would be great if everyone could adapt to that style. But of course, it is hardly realistic to hope for :)
|
|
May 3, 2015 at 16:09 | history | answered | Drew | CC BY-SA 3.0 |