Chandler Carruth
2014-Jan-12 11:00 UTC
[LLVMdev] RFC: Change coding standard to not indent namespaces ever
Currently there is a mixture of indented namespaces and un-indented namespaces in both LLVM and Clang. I think this is confusing and it wastes developer time debating the issue. I'd like to pick one and stick with it consistently. Indenting cannot possibly work in many contexts -- file-wide namespaces just make no sense to indent. So I don't think we should pick "always indent". The common pattern to indent is when there is a small body of code which is within a namespace. The reason for not indenting large bodies of code is that when the namespace spans so much, the indent loses any structural value, and turns into just a cost of losing valuable horizontal space in which to write code. This makes sense to me. But for small blocks of code, the indent has relatively low value -- both the start and end are typically visible on the screen. Why bother indenting this special case? The value seems very, very low. So, I suggest no indent of namespaces ever. I'm happy to make the corresponding change to the coding standards. Naturally, I'm not suggesting rampant re-indenting of code. I'd just like to set a consistent rule going forward so we don't debate this, and know what to do when I see a chunk of code and about to make very significant changes to it and want to clean up formatting while I'm there. -Chandler -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140112/5aa74117/attachment.html>
Tobias Grosser
2014-Jan-12 13:10 UTC
[LLVMdev] RFC: Change coding standard to not indent namespaces ever
On 01/12/2014 12:00 PM, Chandler Carruth wrote:> Currently there is a mixture of indented namespaces and un-indented > namespaces in both LLVM and Clang. I think this is confusing and it wastes > developer time debating the issue. I'd like to pick one and stick with it > consistently. > > Indenting cannot possibly work in many contexts -- file-wide namespaces > just make no sense to indent. So I don't think we should pick "always > indent". > > The common pattern to indent is when there is a small body of code which is > within a namespace. The reason for not indenting large bodies of code is > that when the namespace spans so much, the indent loses any structural > value, and turns into just a cost of losing valuable horizontal space in > which to write code. This makes sense to me. > > But for small blocks of code, the indent has relatively low value -- both > the start and end are typically visible on the screen. Why bother indenting > this special case? The value seems very, very low. > > So, I suggest no indent of namespaces ever. I'm happy to make the > corresponding change to the coding standards. Naturally, I'm not suggesting > rampant re-indenting of code. I'd just like to set a consistent rule going > forward so we don't debate this, and know what to do when I see a chunk of > code and about to make very significant changes to it and want to clean up > formatting while I'm there.Hi Chandler, thanks for pushing to further formalize our coding standards. I fully follow your reasoning and want to add that this is what clang-format is currently already doing. Cheers, Tobias
Sean Silva
2014-Jan-12 19:53 UTC
[LLVMdev] RFC: Change coding standard to not indent namespaces ever
+1 this makes sense. It's what clang-format is already doing anyway, right? -- Sean Silva On Sun, Jan 12, 2014 at 6:00 AM, Chandler Carruth <chandlerc at gmail.com>wrote:> Currently there is a mixture of indented namespaces and un-indented > namespaces in both LLVM and Clang. I think this is confusing and it wastes > developer time debating the issue. I'd like to pick one and stick with it > consistently. > > Indenting cannot possibly work in many contexts -- file-wide namespaces > just make no sense to indent. So I don't think we should pick "always > indent". > > The common pattern to indent is when there is a small body of code which > is within a namespace. The reason for not indenting large bodies of code is > that when the namespace spans so much, the indent loses any structural > value, and turns into just a cost of losing valuable horizontal space in > which to write code. This makes sense to me. > > But for small blocks of code, the indent has relatively low value -- both > the start and end are typically visible on the screen. Why bother indenting > this special case? The value seems very, very low. > > So, I suggest no indent of namespaces ever. I'm happy to make the > corresponding change to the coding standards. Naturally, I'm not suggesting > rampant re-indenting of code. I'd just like to set a consistent rule going > forward so we don't debate this, and know what to do when I see a chunk of > code and about to make very significant changes to it and want to clean up > formatting while I'm there. > > -Chandler > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140112/cb97bb80/attachment.html>
Chris Lattner
2014-Jan-13 15:25 UTC
[LLVMdev] RFC: Change coding standard to not indent namespaces ever
On Jan 12, 2014, at 3:00 AM, Chandler Carruth <chandlerc at gmail.com> wrote:> Currently there is a mixture of indented namespaces and un-indented namespaces in both LLVM and Clang. I think this is confusing and it wastes developer time debating the issue. I'd like to pick one and stick with it consistently. > > Indenting cannot possibly work in many contexts -- file-wide namespaces just make no sense to indent. So I don't think we should pick "always indent". > > The common pattern to indent is when there is a small body of code which is within a namespace. The reason for not indenting large bodies of code is that when the namespace spans so much, the indent loses any structural value, and turns into just a cost of losing valuable horizontal space in which to write code. This makes sense to me. > > But for small blocks of code, the indent has relatively low value -- both the start and end are typically visible on the screen. Why bother indenting this special case? The value seems very, very low. > > So, I suggest no indent of namespaces ever. I'm happy to make the corresponding change to the coding standards. Naturally, I'm not suggesting rampant re-indenting of code. I'd just like to set a consistent rule going forward so we don't debate this, and know what to do when I see a chunk of code and about to make very significant changes to it and want to clean up formatting while I'm there.+1 from me. -Chris
Aaron Ballman
2014-Jan-13 16:03 UTC
[LLVMdev] RFC: Change coding standard to not indent namespaces ever
I think your logic is sound, +1 from me, FWIW. ~Aaron On Mon, Jan 13, 2014 at 10:25 AM, Chris Lattner <clattner at apple.com> wrote:> > On Jan 12, 2014, at 3:00 AM, Chandler Carruth <chandlerc at gmail.com> wrote: > >> Currently there is a mixture of indented namespaces and un-indented namespaces in both LLVM and Clang. I think this is confusing and it wastes developer time debating the issue. I'd like to pick one and stick with it consistently. >> >> Indenting cannot possibly work in many contexts -- file-wide namespaces just make no sense to indent. So I don't think we should pick "always indent". >> >> The common pattern to indent is when there is a small body of code which is within a namespace. The reason for not indenting large bodies of code is that when the namespace spans so much, the indent loses any structural value, and turns into just a cost of losing valuable horizontal space in which to write code. This makes sense to me. >> >> But for small blocks of code, the indent has relatively low value -- both the start and end are typically visible on the screen. Why bother indenting this special case? The value seems very, very low. >> >> So, I suggest no indent of namespaces ever. I'm happy to make the corresponding change to the coding standards. Naturally, I'm not suggesting rampant re-indenting of code. I'd just like to set a consistent rule going forward so we don't debate this, and know what to do when I see a chunk of code and about to make very significant changes to it and want to clean up formatting while I'm there. > > +1 from me. > > -Chris > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Renato Golin
2014-Jan-13 16:13 UTC
[LLVMdev] RFC: Change coding standard to not indent namespaces ever
LGTM. --renato On 12 January 2014 11:00, Chandler Carruth <chandlerc at gmail.com> wrote:> Currently there is a mixture of indented namespaces and un-indented > namespaces in both LLVM and Clang. I think this is confusing and it wastes > developer time debating the issue. I'd like to pick one and stick with it > consistently. > > Indenting cannot possibly work in many contexts -- file-wide namespaces > just make no sense to indent. So I don't think we should pick "always > indent". > > The common pattern to indent is when there is a small body of code which > is within a namespace. The reason for not indenting large bodies of code is > that when the namespace spans so much, the indent loses any structural > value, and turns into just a cost of losing valuable horizontal space in > which to write code. This makes sense to me. > > But for small blocks of code, the indent has relatively low value -- both > the start and end are typically visible on the screen. Why bother indenting > this special case? The value seems very, very low. > > So, I suggest no indent of namespaces ever. I'm happy to make the > corresponding change to the coding standards. Naturally, I'm not suggesting > rampant re-indenting of code. I'd just like to set a consistent rule going > forward so we don't debate this, and know what to do when I see a chunk of > code and about to make very significant changes to it and want to clean up > formatting while I'm there. > > -Chandler > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140113/b8159cf2/attachment.html>
Chandler Carruth
2014-Jan-20 01:46 UTC
[LLVMdev] RFC: Change coding standard to not indent namespaces ever
Hearing no objections and support from various parts of the community, committed in r199620. I made sure to mention using ending comments to clarify where things end when useful. On Sun, Jan 12, 2014 at 3:00 AM, Chandler Carruth <chandlerc at gmail.com>wrote:> Currently there is a mixture of indented namespaces and un-indented > namespaces in both LLVM and Clang. I think this is confusing and it wastes > developer time debating the issue. I'd like to pick one and stick with it > consistently. > > Indenting cannot possibly work in many contexts -- file-wide namespaces > just make no sense to indent. So I don't think we should pick "always > indent". > > The common pattern to indent is when there is a small body of code which > is within a namespace. The reason for not indenting large bodies of code is > that when the namespace spans so much, the indent loses any structural > value, and turns into just a cost of losing valuable horizontal space in > which to write code. This makes sense to me. > > But for small blocks of code, the indent has relatively low value -- both > the start and end are typically visible on the screen. Why bother indenting > this special case? The value seems very, very low. > > So, I suggest no indent of namespaces ever. I'm happy to make the > corresponding change to the coding standards. Naturally, I'm not suggesting > rampant re-indenting of code. I'd just like to set a consistent rule going > forward so we don't debate this, and know what to do when I see a chunk of > code and about to make very significant changes to it and want to clean up > formatting while I'm there. > > -Chandler >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140119/2c78b729/attachment.html>