Talk:Indent style
|
I like to pull returns and break to the left, so that the flow break is very visible, but this probably a brainchild of mine that never caught on.
Has anyone considered merging this article with the material under indentation? I think they are both children of the Jargon File entry on the same. --Ardonik 00:46, Jul 16, 2004 (UTC)
- I would argue to keep them separate. Indentation has a seperate meaning to that in computing. The text in this article is a bit more refined, IMO, as well, so perhaps merge the programming stuff in Indentation here. Dysprosia 02:08, 16 Jul 2004 (UTC)
- What if this page was moved to Programming Styles, and the examples fleshed out to, maybe, 7 lines to show how variables are named and where spaces go?
- I suggest this because a "Programming Styles" page would be useful, but if it existed it would duplicate the info on this page. So, if I get the time some night, any objections to me turning this into a full blown Programming Styles article? Gronky 23:11, 29 Jul 2004 (UTC)
- What other styles are there? As this page says, there are other indenting or whatever styles used by people, which come and go. If you're talking about variable naming and spacing or whatever, we have articles on Hungarian notation and Camel case and naming convention or whatever, so I think it may just duplicate those articles. Dysprosia 03:11, 30 Jul 2004 (UTC)
The pros and cons for GNU style looked like filler, so I'm guessing no one was madly attached to them. While 2+2 == 4, GNU style won't produce any more line overflow than the other styles. As a GNU styler, I know the con I've written is true. Gronky 23:43, 28 Jul 2004 (UTC)
I added a note to point out that indentation isn't ALWAYS just a matter of readability. A number of programming languages use the indentation to DETERMINE the structure of the program - rather than it merely being a matter of readability. Occam and Python came to mind - if anyone knows of others - they should probably be added.
Older Fortran and Cobol compilers had annoying restrictions on indentation. --DavidCary 18:02, 20 Apr 2005 (UTC)
It might also be good to add one or two examples in other languages. Indentation of Pascal using anything other than BSD style would look pretty nasty. How do people indent LISP?
if (x < 0) { printf("Negative"); negative(x); } else { printf("Positive"); positive(x); }
K&R style
if(x<0){ printf("Negative"); negative(x); }else{ printf("Positive"); positive(x); }
Another common style that squeezes out even more spaces. Is there a name for this style? Other than Avoiding Guido's pet peeves (http://www.python.org/doc/essays/styleguide.html)? --DavidCary 18:02, 20 Apr 2005 (UTC)
- It actually sort of looks more like Python than many other styles... Fredrik | talk 18:21, 20 Apr 2005 (UTC)
NPV
Can someone have a look at the writeups for the styles to make sure they're NPV? The article seems to favor BSD/Allman by using "proponents of this style" with the other two. I'm not sure this is appropriate, and looks like a simple fix for someone familiar with the topic. --Steven Fisher 06:53, 29 Apr 2005 (UTC)
- Okay, I decided to give it a go myself. Please have a look and see if I've screwed anything up. --Steven Fisher 03:26, 7 May 2005 (UTC)
Another format I use.
There is a format I sometimes use which I find very readable:
if (x < 0) { printf("Negative"); negative(x); } else { printf("Positive"); positive(x); }
This is eccanomic with lines so that a page of code scans well. I also think it shows the content of the section very clearly, since all lines in the section without exception are intented by the same amount.
ben@clewett.org.uk
- Fine, but due to Wikipedia:No original research, we don't include people's own personal styles. Dysprosia 12:34, 17 Jun 2005 (UTC)