From murdoch at stats.uwo.ca  Sun Nov 29 18:18:23 2009
From: murdoch at stats.uwo.ca (Duncan Murdoch)
Date: Sun, 29 Nov 2009 12:18:23 -0500
Subject: [Rd] Tabs in R source code
In-Reply-To: <366c6f340911290850o3d4e16dfg3e2318339f0b0f92@mail.gmail.com>
References: <366c6f340911290758t71dd256dtd7975a49ae9155a7@mail.gmail.com>	<4B12A3FD.9010006@stats.uwo.ca>
	<366c6f340911290850o3d4e16dfg3e2318339f0b0f92@mail.gmail.com>
Message-ID: <4B12ACDF.2030506@stats.uwo.ca>

On 29/11/2009 11:50 AM, Peng Yu wrote:
> On Sun, Nov 29, 2009 at 10:40 AM, Duncan Murdoch <murdoch at stats.uwo.ca> wrote:
>> On 29/11/2009 10:58 AM, Peng Yu wrote:
>>> Some lines are indented by tabs and some lines are indented by spaces,
>>> in R source code. This might due to the fact that the source code is
>>> not from a single person. But I think that it is better to enforce a
>>> single convention.
>>>
>>> My editor defaults a tab to 8 spaces. So some source doesn't seem to
>>> be indented correctly in my editor. Since tab may be displayed
>>> differently in different editor, I recommend to replace all the tabs
>>> by the appropriate number of spaces to ensure the same indentation
>>> display.
>> The R source code assumes that tabs occur every 8 columns, so if your editor
>> is working properly, it should display files as intended.
>>
>>> Could somebody update the source code in the future version by
>>> replacing tabs by spaces and enforce such a coding convention in the
>>> future?
>> No, that would not be feasible, for the reason you give in the second
>> sentence of your post.
> 
> I don't understand why it is not feasible. The spaces are displayed
> the same in all editors. If there are no tabs, the code should display
> the same in all editors. I know some languages that are recommended to
> have spaces rather than tabs for this reason.

It is not feasible because it would require everyone who edits the 
source code to change the configuration of their editors.  In my case, 
that would require changing about 3 different types of editors (I work 
on several different platforms).  I would probably miss one, and 
re-introduce tabs the next time I edited a file on that editor.

I've already seen problems in the NEWS and CHANGES files, which have 
recently changed to UTF-8 encoding.  It's very irritating that my editor 
switches back to the Windows default if it doesn't see a byte-order 
mark, and that some editors that I use automatically delete the BOM. 
Requiring a particular "encoding" for tabs (i.e. converting them to 
spaces) would lead to the same problems, but on a much bigger scale.

Duncan Murdoch



[Rd] Tabs in R source code
Duncan Murdoch