Hacker News new | past | comments | ask | show | jobs | submit login

I've gone to uppercase. SQL is a noisy language, with lots of keywords cluttering up your code. I write the keywords in uppercase, and the table and column names in camel case. It seems to make the usefull stuff easyer to find, and the camel case gives a bit of extra info where it matters.



True. This is exactly why I do it too. I wish SQL was less like English and more like a computer language.


Oh, that does make some sense. So basically in languages like Python, Lisp and Lua you would use uppercase for identifiers like variable names to separate them from keywords and builtins, whereas in languages like Perl and C you would not, because the syntax is designed to highlight keywords through punctuation anyway?


Good question. I think the answer is no -- I never promised consistency ;-)

For Python, I'd follow PEP8 [1], as it is more important to follow the local programming culture, even if it has some warts. Otherwise, programs from multiple people would quickly become messy, and learning and code reuse between projects becomes harder.

I didn't do much lisp, but considered the builtins as library functions I theoretically could have written myself. So they were lower case, as coherent with all other names of functions etc...

Can't comment on Lua, I've done <100 lines of it and forgot basically all of it.

I used to write BASIC keywords in upper case and vars lowercase (GOTO longlongago)

Tradeoffs, tradeoffs, tradeoffs, as always. I presume SQL has not much consistency in formatting and casing, so I grew my own convention.

[1] https://peps.python.org/pep-0008/#prescriptive-naming-conven...


Lisp is not a language, but a language family. You might be thinking of some case-sensitive member of the family.

Common Lisp is case-folding to upper case by default so DEFUN and defun are the same; both tokens denote a symbol whose name is the character string "DEFUN".

Symbol names themselves are sensitive; "DEFUN", "Defun" and "defun" are all different character strings and different symbol names. (find-symbol "defun") will not find the defun symbol.

In Common Lisp, you can carry on the sane coding convention as described by the grandparent comment, whereby built-ins like DEFUN and LET are written in upper case, and your own identifiers are mixed case.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: