3 ms·
curious, why do you prefer snake_case to kebab-case?
by ithrow 4y ago
curious, why do you prefer snake_case to kebab-case?
- IshKebab 4y agoNever 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.
- MH15 4y agokebab-case conflicts with binary expressions, specifically subtraction? Some parser jujitsu would be required to fix this.
- zozbot234 4y agoGenerally, 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.
- samatman 4y agoNot 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.
- avgcorrection 4y agoI 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`.