SQL call formatting style

Gervase Markham gerv at mozilla.org
Sat Mar 29 22:39:18 UTC 2003


Christopher Hicks wrote:
> Around simple single-line strings I tend to agree, but when you're dealing 
> with multi-line SQL statements or other significant hunks of inline text, 
> the q{} form isn't as grating.

Perhaps not for you :-)

>>We should choose what's most readable for most people in the common
>>case.
> 
> Readability is deceptive in this case.  I doubt anyone wants '' because
> you have to escape the 's often needs.  

But, as bbaetz said, it's rare that we need to embed a ' because we 
usually use parameters. And using ' means you don't have to escape any 
other character.

> Obviously these folks were ignoring warnings and otherwise naive, but it
> exhibits that people new to perl don't consider the interpolation effects.  
> In teaching Perl I've seen a lot of students, particularly those from the
> C and COBOL worlds trip over this.  So, you're left teaching people the
> plethora of interpolation intricacies or "hay, these q{} things are safe
> quotes".  Particularly if the q{} is used through the main code base,
> people will end up cutting and pasting it, and get used to the paradigm. I
> suspect that doing so would help avoid bugs.  Avoiding escaping seems like 
> a readability win too.

I'm not convinced by any of this :-)

- If people's code is creating warnings, it won't get checked in
- If people don't understand interpolation in Perl, I'd be wary about 
letting them write code for Bugzilla
- If "" was used throughout the main codebase, people would also cut and 
paste it, and be used to using that.
- If we want to avoid escaping, let's use ' (see above.)

Anyway, we are now going round in circles, and it's time for a justdave 
ruling :-)

Dave? Pick a "standard", or say there's none and everyone can use 
whatever quoting style they like.

Gerv




More information about the developers mailing list