On Thu, Mar 13, 2014 at 12:52 AM, Brandon <
wong...@gmail.com> wrote:
> I try to use single quote first as much as I can because I find the
> readability is better and it takes up less spaces each line.
I've started doing the opposite. The tiny time savings in the
interpreter from not checking for interpolation, pale in comparison to
the human-time wasted by "why is it failing to do the interpolation I
added, oh, I didn't convert the quotes" and "why is it blowing up on
this perfectly innocent string, oh, I used a contraction inside
single-quotes so it thinks the string ends there" and whatever other
problems it causes. If you've got some special case of a frequently
run tight loop where shaving off a few microseconds by using single
quotes to forestall interpolation-checks might actually help, go for
it... but otherwise it's premature optimization. Go ahead and get in
the habit of pressing the @#$%^&* shift key, most programmers need all
the exercise they can get anyway. ;-)
Meanwhile, though, I'm curious. Can you articulate why you feel
single-quotes have better readability? I suspect it's a matter of
what other languages you're used to, both human and computer. In
English, most books enclose most quotes in double-quotes, versus the
<< and >> used in many mainland-European languages, and whatever else
may be used elsewhere. (I am not aware of any that use mainly
single-quotes. Anybody?) Prior to Ruby, most of my career was in C,
where double-quotes are required for strings -- it threw me a bit when
I first got into JavaScript where single-quotes seem to be the
predominant style.
Also, what do you mean "it takes up less spaces each line"? Either
one is a single character. Are you coding in a proportional-width
font? If so, I think you'll find it easier to visualize things about
your code if you code in monospace.
-Dave
--
Dave Aronson, FREELANCE SOFTWARE DEVELOPER LOOKING FOR REMOTE CONTRACTS
(or temp jobs, or in/near Fairfax VA; see
www.Codosaur.us for details);
see also
www.PullRequestRoulette.com,
Blog.Codosaur.us,
www.Dare2XL.com