Double quotes ?
Closed this issue · 3 comments
waghanza commented
Hi,
New to rufo
, I can see that string surrounded by simple quotes are turned into double quotes surrounded ones ?
As I remembered, simple quotes string are less resource consuming if there is no interpolation in it, right ?
Regards,
glebm commented
Not sure whether there is a performance benefit but it's less mental overhead - if I see a single-quoted string I know it won't have any interpolations / escape sequences
bessey commented
I don't think this is clear cut, personally I use always double quotes
because:
1. Performance is completely irrelevant. There isn't a difference in
performance between "a string" and 'a string', but even if there were, how
a string is instantiated is a minuscule proportion of any programs runtime
and is not that right thing to be optimising. A better concern is avoiding
repeated string allocation via the frozen string literal magic comment.
2. I think it is self evident when a string has interpolation in it without
having differing syntax
3. I don't want to have to change the syntax of a string back and forth as
I add and remove interpolation syntax.
Per the rubocop ruby-style-guide
<https://github.com/rubocop-hq/ruby-style-guide#strings> I am an option b
person
…On Mon, 11 Jun 2018 at 05:52 Marwan Rabbâa ***@***.***> wrote:
no performance diffs ?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#103 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AArOaFjT70z1V0Cxfe8cDccIpz2h7r8_ks5t7feZgaJpZM4UeD0Y>
.
wuarmin commented
Check this out!! After all it's a decision about performance: https://anti-pattern.com/always-use-double-quoted-strings-in-ruby