Closed rye closed 8 years ago
For comparison's sake, take a peek at the example of difference between these two different styles:
I think the latter looks much better.
In the past, we would use double quotes specifically because we didn't have to think if we wanted to do anything special. Also, a mix is kind of weird. Does a mix look better than more clutter (because double quotes have double the lines)?
A mix is kind of weird. Does a mix look better than more clutter?
Yes. Preferring single quotes will replace, I'd imagine, somewhere around 95% of the quotes with single quotes. Double quotes will then only be used where there is need for interpolation or special ASCII magic. It would make sense to do this, I think.
Most files will only need single quotes, I should add. If we want to do interpolation with just single quotes, it's fairly simple, too—just use the String#%
method which formats according to the given format specifier, as in the following example:
'Hello, %s %s %s!' % ['Johnny', 'Jackson', 'Appleseed']
=> 'Hello, Johnny Jackson Appleseed!'
This works decently well. Of course, the String
's in that Array
could be any Object
's that respond to #to_s
.
I feel like this is a fairly trivial matter and that we shouldn't have to spend time worrying about this kind of thing.
On Sun, Dec 6, 2015 at 1:07 PM Kristofer Rye notifications@github.com wrote:
Most files will only need single quotes, I should add. If we want to do interpolation with just single quotes, it's fairly simple, too—just use the String#% method which formats according to the given format specifier, as in the following example:
'Hello, %s %s %s!' % ['Johnny', 'Jackson', 'Appleseed'] => 'Hello, Johnny Jackson Appleseed!'
This works decently well. Of course, the String's in that Array could be any Object's that respond to #to_s.
— Reply to this email directly or view it on GitHub https://github.com/frc-frecon/frecon/issues/84#issuecomment-162332668.
You're right. I'd love to hear more on issues that actually matter like #57. But since this kind of stuff is still important and would be a large enough change in terms of SLoC, I figure getting input from other developers is nice. Since this is just so trivial, though, I'll go ahead and do it later this afternoon.
Yeah, sorry about not getting to #57 as quickly as I really should. It's been stuck as low priority but still prioritized mail to attend to. Newer stuff keeps on passing it in the urgency list. :/
-Sam
Sent using CloudMagic Email [https://cloudmagic.com/k/d/mailapp?ct=pa&cv=8.0.67&pv=5.1&source=email_footer_2] On Tue, Dec 08, 2015 at 6:09 PM, Kristofer Rye < notifications@github.com [notifications@github.com] > wrote: Closed #84 [https://github.com/frc-frecon/frecon/issues/84] via a75d272 [https://github.com/frc-frecon/frecon/commit/a75d272bd14685b52a9c8e0f4ef5fbc172ddc4dd] .
— Reply to this email directly or view it on GitHub [https://github.com/frc-frecon/frecon/issues/84#event-486271645] .[https://github.com/notifications/beacon/AC7z1rjFesdVuNdanrTQ9TBCnTQ0Wo0Eks5pN1qrgaJpZM4GvfGX.gif]
This is not, of course, actually very relevant to this thread, but to be honest I feel like this change did not really warrant a new release. I would have just merged it and then waited for changes that actually changed the behavior of the program in order to make a new release.
Not a big deal, but I just wanted to offer the suggestion.
Since I've learned that single quotes and double quotes are actually, functionally, quite different—that is, single quotes do not perform string interpolation or ASCII escaping, while double quotes do perform these—I've started using single quotes quite a bit more because they're faster to type. (requiring only one keystroke to insert instead of a chord of two different keys) Double quotes are still used in situations where String interpolation is required or ASCII escaping is required, but, for example, in the
frecon.gemspec
file, they add visual clutter where it's not necessary.Unless I hear objections, I'll probably start converting all of the quotes over in a sane manner. This will help us follow community standards where people primarily use single quotes except when they need special functionality. It'll probably make stuff look better.