Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I'm happy to see Odin chose snake_case instead of camelCase. At one time Zig debated switching to snake case, but that ship has sailed [0], sadly.

It seems like a small bike-shed level comment, but when I consider the code I have left in me, I'd like it to look as nice as possible.

0 https://github.com/ziglang/zig/issues/1097



My fingers hate snake_case unless I'm in an IDE with working auto complete, and even then the repeated "shift-minus" when defining variables/functions is just hell on my typing speed. I don't have to remap my keyboard to avoid RSI when using camelCase, and I also don't have to switch keyboard apps on my phone when typing code examples.


I totally understand the preference, as using snake_case has grown on me. But, when you jump between many languages (with different case usage), you kind of have to be agnostic about such things.


I much prefer camelCase over snake_case. No idea why.


curious, why do you prefer snake_case to kebab-case?


I prefer kebab-case but it’s apparently too much to ask for in infix languages because most of them insist on allowing expressions like `a+b-c`.


Never use kebab-case. Not even where you can (e.g. filenames). Sooner or later you're going to want that name as an identifier in a programming language that doesn't support it (approximately all of them), and then you're going to have to come up with annoying rules to convert between them, and make all the code that uses it harder to follow and to grep.

Obvious example is CSS.


kebab-case conflicts with binary expressions, specifically subtraction? Some parser jujitsu would be required to fix this.


Generally, kebab-case means that operators must be separated by spaces. Languages like FORTH or LISP might not even treat operators as separate from ordinary functions.


Not with a parsing expression grammar! They make it easy to say that operators must be separated by spaces only when the alternative would be a valid identifier, and if you disallow trailing hyphens this matches most cases:

   a-variable; a-1, a-(expr()), 1-a-variable (don't do this)
I think the last one illustrates why this will never be popular.




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

Search: