News for hackers. Stuff that matters.
Re:CamelCase vs. Underscores: Revisited by userbinator on Wednesday January 25, 2023 @10:17PM (#34527313)
Why not both and neither? IMHO this is one of those things where people seem to congregate and advocate for one side religiously, but I don't see much value in that. Why can't the style simply imply how much scope and importance an identifier has? I've never liked naming dogma, but this is what I find to be natural:

    trivialidentifier - local variables inside a function, usually < 3 words/abbrs
    slightly_important_identifier - function names with limited scope
    ImportantIdentifier - widely-used functions, class/struct names
    More_Important_Identifier - classes/structs that are quite important
    VERY_IMPORTANT_IDENTIFIER - global constants and (rarely) classes/structs
Re:CamelCase vs. Underscores: Revisited by __ryan__ on Wednesday January 25, 2023 @10:44PM (#34527444)

  Why can't the style simply imply how much scope and importance an identifier has? 
Because lack of underscores doesn’t unanimously imply lack of importance or scope.
Re:CamelCase vs. Underscores: Revisited by kelnos on Wednesday January 25, 2023 @11:04PM (#34527548)
That seems less understandable to me. I think it's easier to grok if certain classes of things always use the same casing. So all functions would use snake_case, type names would use PascalCase, global constants use UPPER_CAMEL_CASE, etc.

"Importance" is subjective, and regardless, IMO not really an important measure of anything.

Re:CamelCase vs. Underscores: Revisited by layer8 on Wednesday January 25, 2023 @11:08PM (#34527571)
Because everyone will have a different opinion about the importance of any given name.
Re:CamelCase vs. Underscores: Revisited by andreareina on Thursday January 26, 2023 @03:29AM (#34529171)
Hell I'll have differing opinions about the importance of the same name at different times of day.
Re:CamelCase vs. Underscores: Revisited by rootusrootus on Wednesday January 25, 2023 @11:21PM (#34527646)
That's sort of what Python's PEP8 recommends. CamelCase for class names, snake_case for the rest, and SNAKE_CASE for constants.
Re:CamelCase vs. Underscores: Revisited by cpeterso on Thursday January 26, 2023 @12:24AM (#34527995)
And Ruby and Rust.
Re:CamelCase vs. Underscores: Revisited by jjgreen on Thursday January 26, 2023 @04:25AM (#34529516)
Shame that the standard library doesn't follow those recommendations (hello unittest).
Re:CamelCase vs. Underscores: Revisited by pavo-etc on Thursday January 26, 2023 @07:46AM (#34530994)
also startswith(), endswith()
Re:CamelCase vs. Underscores: Revisited by dotancohen on Thursday January 26, 2023 @04:40AM (#34529635)
Interestingly, PHP's PSR family specifically does _not_ take a stance on naming conventions for locally-scoped variables.
Re:CamelCase vs. Underscores: Revisited by scns on Thursday January 26, 2023 @03:52AM (#34529318)
I call it CONSTANT_CASE and use it for constants.
Re:CamelCase vs. Underscores: Revisited by layer8 on Thursday January 26, 2023 @02:47PM (#34537700)
It’s commonly called ALL_CAPS (e.g. https://gcc.gnu.org/codingconventions.html#C_Names).