3 ms·
Really just a matter of convention, and dash is too heavily associated with minus. A single underscore is a permissible variable name in some languages; in Go
by libria 14y ago
Really just a matter of convention, and dash is too heavily associated with minus. A single underscore is a permissible variable name in some languages; in Go it has a special meaning (blank identifier). Would a single dash be as well? For example, how would you interpret
i - -
Is it i (minus) (variable named dash)? And is `i--` a legitimate variable name? Maybe Ruby doesn't have this construct, but then it would have a completely different naming contention from existing languages.
- ajanuary 14y agoFavouring dash over underscore to break words in variable names doesn't preclude using underscores in variables names ever. A sometimes used _ is okay. Its_using_it_almost_all_the_time_that_the_author_is_questioning.