[haiku-development] Re: Coding guidelines

  • From: Stephan Assmus <superstippi@xxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Sat, 08 May 2010 15:53:57 +0200

On 2010-05-08 at 14:10:48 [+0200], Niels Reedijk <niels.reedijk@xxxxxxxxx> 
wrote:
> Hi Stephan,
> 
> On 8 May 2010 13:59, Stephan Assmus <superstippi@xxxxxx> wrote:
> >
> > On 2010-05-08 at 14:01:07 [+0200], Niels Reedijk <niels.reedijk@xxxxxxxxx>
> > wrote:
> >> On 8 May 2010 13:58, Niels Reedijk <niels.reedijk@xxxxxxxxx> wrote:
> >> > Hi,
> >> >
> >> > On 8 May 2010 01:16, Jorge G. Mare <koki@xxxxxxxxxxxxx> wrote:
> >> >> On 05/07/2010 03:50 PM, Markku Hyppönen wrote:
> >> >>
> >> >> I've been asked to change few files to follow the coding guidelines.
> >> >>
> >> >> Document says that indent should be set to four spaces
> >> >> and that a line must not have more than 80 columns but in the first
> >> >> example indents seems to be mainly 8 character and there's also couple
> >> >> of lines exceeding 80 columns.
> >> >>
> >> >> It seems examples code is not valid, right?
> >> >>
> >> >>
> >> >> If you are referring to the sample code under "Indenting and white 
> >> >> space"
> >> >> in...
> >> >>
> >> >> http://www.haiku-os.org/development/coding-guidelines
> >> >>
> >> >> ...then you are pointing out the same problem already reported in 
> >> >> ticket
> >> >> #5901 by Stippi.
> >> >>
> >> >> One of the sysadmins responded that " a \t is interpreted as 8 spaces 
> >> >> and
> >> >> this cannot be changed" and closed the ticket as invalid, but this is
> >> >> incorrect.
> >> >>
> >> >> At least in the particular case of the Haiku website, it is possible 
> >> >> to
> >> >> change the number of spaces per tab stop, and the solution was given 
> >> >> in
> >> >> comments 2 and 3 of the same ticket:
> >> >
> >> > Changed that, does not work.
> >>
> >> Also, looking from the docs:
> >> http://qbnz.com/highlighter/geshi-doc.html#setting-tab-width, Genshi
> >> will replace the tabs with spaces (not sure if that would be only
> >> within a div), which would also be wrong.
> >>
> >> Resolution is correct.
> >
> > I don't agree. It's highly confusing. The last resort solution would be to
> > dump the <code> auto-layout and layout the coding style page code 
> > examples by
> > hand.
> 
> So you would then implement a filter that finds the tabs, transforms
> them into spans with a non-breakable space, tries to determine how
> wide the spaces are and then makes the width times four. You might as
> well ask W3C to update the HTML draft (one of the rumours I read is
> that in some of the HTML5 drafts there is indeed a CSS property to
> configure this floating around).
> 
> In the mean time either choose to keep the code formatted this way, or
> change the tabs into four spaces. I think the current situation is
> more clear (or actually, less unclear).

Yes, replacing the tabs by four spaces is what I had in mind as acceptable 
solution. IMHO it is more likely for a reader to think the spaces are some 
HTML issue than that the tabs are wider than intended (and he is only going 
to wonder at all when selecting or copying and pasting, while the the current 
situation is going to be noticed by anyone just looking at the page). If for 
some reason you paste the website contents into an editor that is at the 
moment configured for 8 spaces per tabs, than it's even going to look like on 
the webpage. Copying and Pasting the code did no good then. I'd rather have 
the page show the code how it's supposed to look.

Best regards,
-Stephan

Other related posts: