3 ms·
Because it lets you use single quotes ("isn't") or double quotes ('error: "%s"') without escaping ('isn\'t', "error: \"%s\""). A rare case where readability an
by Ao7bei3s 6y ago
Because it lets you use single quotes ("isn't") or double quotes ('error: "%s"') without escaping ('isn\'t', "error: \"%s\"").
A rare case where readability and consistency may not be the same. (Let's not argue about this, it's subjective. I'm aware of the obvious counter- and counter-counter-arguments, such as syntax hilighting and greppability.)
- ed25519FUUU 6y agoThe problem is that a single quote will often times appear in strings as well, and sometimes (like in the case of bash) can't even be escaped. So you end up requiring double quotes either way. Why not just settle permanently on double quotes? This is what Go and other languages did and I think it's a good idea.
- dragonwriter 6y ago> The problem is that a single quote will often times appear in strings as well, but they can't be escaped While having choice of quotes reduces the need for escaping, most languages that provide it also still support escaping. E.g., Ruby has double-quoted strings with escaping, single-quotes without, %Q(...) with, %q(...) without, and two different heredoc forms, with and without escaping (the forms that allow escaping also support interpolation).
- VWWHFSfQ 6y ago> This is what Go and other languages did and I think it's a good idea. Well Lua is about 30 years old and Go is, what, 10 years old? I would expect a language that is barely a decade old to improve on past ideas and mistakes.
- m4r35n357 6y ago\