5 ms·
I wonder if the capitalization is required. What modern programming language would require capitalization? I use it in SQL and that makes sense given that SQL i
by djha-skin 4y ago
I wonder if the capitalization is required. What modern programming language would require capitalization? I use it in SQL and that makes sense given that SQL is often embedded in other programming language via strings and so the capitalization helps because there are there's no syntax highlighting. But otherwise I don't see the point of it.
- rmorey 4y agoI had never heard this justification for sql YELLING AT ME but honestly it makes sense!
- giancarlostoro 4y agoWhen a Junior developer doesn't capitalize their SQL it makes my eye twitch, and it's not that I personally care, it's just that I'm so used to seeing it as a standard, and my brain wants to go with standards always.
- zach_garwood 4y agoI'm kinda the opposite. I always saw the older developers writing SQL in lowercase, so now when I see someone using caps, I think they must have just read a SQL book or something.
- EddySchauHai 4y agoCaps with nice tabular lining so everything is neat. Handwritten SQL can feel a little like art, I really enjoy making mine look as uniform as possible
- maleldil 4y agoI don't understand what you mean. Can you provide an example?
- EddySchauHai 4y agoThings like 'rivers down the middle' [0] [1] Because SQL has so many opinionated style guides rather than the One True Way I really enjoy spending time, if I have it, on making my SQL as Uniform and legible as I can. Sadly this is all closed source code nowadays. But my SQL files look almost like a table with clear 'rivers' along keywords. It makes my OCD brain go a little fuzzy inside when I finish :) Also having worked on a MONSTER of a financial system powered by stored procs and autogenerated SQL, I'm talking million line SQL files you can't load in a GUI, I am very fond of legible small SQL scripts nowadays. [0] https://gist.github.com/mattmc3/38a85e6a4ca1093816c08d4815fbebfb https://gist.github.com/mattmc3/38a85e6a4ca1093816c08d4815fb... [1] https://www.sqlstyle.guide/#white-space https://www.sqlstyle.guide/#white-space
- rprospero 4y agoI rarely touch SQL, so I don't really have much of an opinion on these matters. However, the last time I did have to touch it, the senior developer on the project used this as his personal shibboleth for differentiating junior and senior developers. By his reckoning, junior developers put SQL statements in caps because they were used to seeing that in textbooks. Senior developers would realise the importance of maintainability and use lower case out of respect for the next person to read the code.
- 1MachineElf 4y agoSurely there must be code formatters for SQL that alleviate this issue for large teams.
- cestith 4y agoAll-capital writing is far harder to read for extended periods of time. If you're looking a a few short SQL statements embedded in other code or something, that's not a big issue. If you're editing screen-filling report queries or editing a long data structure full of various SQL statements, it's a bigger deal.
- asdajksah2123 4y agoI believe the argument here is that since it's currently an experimental language, future versions might include many currently unplanned keywords. By making keywords all caps, (and presumably no other user defined names are all caps...I'm not sure if this is enforced by the language or not, but it's a simple enough convention that there is a very low likelihood of it being broken) you ensure that you have the entire namespace of words available to you as keywords for future enhancements to the language.
- asdajksah2123 4y agoFrom the "Design Principles" section that points out other rules (that seem to be compiler enforced) and the reasoning behind it: ------------ 5. The next compiler version will add a new feature Once a compiler version is released programs will be written and distributed. The next version must not break the existing programs. Thus it must be possible to add keywords, types, modules, etc. without worrying that this might break someone's carefully crafted code. Keywords are all-caps. No user symbol may be all-caps Builtin type names are all lowercase. User types must start with an uppercase letter. Builtin module names are all-caps. User modules must contain a lowercase letter. Predefined methods start with an uppercase letter. User methods must start with a lowercase letter. This may seem a bit strange at first, but one gets used to it very quickly. And the compiler gives a clear error message when making a mistake.
- indentit 4y agoBut there is syntax highlighting - what editor and language combination are you using? I know for a fact that SQL is highlighted inside Python and PHP strings in Sublime Text 4..
- emaginniss 4y agoIntelliJ will not only syntax highlight your embedded SQL, but also match it to your data source's schema to ensure correctness.
- dskloet 4y ago> What modern programming language would require capitalization? In Go fields are made public by starting their name with an upper case.