Take this email I received from Philip Leitch: The more programmers you add, the more divisive those disagreements get. Wherever there are two programmers working on the same project, there are invariably disagreements about how the code should be formatted. The only programming project with no disagreement whatsoever on code formatting is the one you work on alone. Or, maybe you're using a next- next-generation editor that treats code as "data" and the layout (including whitespace) as a "view", making all these concerns largely irrelevant.īut there's a deeper issue here to consider. Perhaps you have some kind of fancy auto-formatter that runs on every checkin. spaces on your personal path to code nirvana. You've moved beyond mere earthbound issues like tabs vs. OK, so maybe you're an enlightened coder. But I'm more inclined to think of it as combining all the complexity and pitfalls of both approaches, myself. This way, in theory at least, the level of indent can be adjusted dynamically without destroying alignment. Apparently you can use tab for primary indentation alignment and then spaces on top of that for detail alignment. So, then, the question: should code* be indented with spaces.Īccording to Cyrus, there's a third option: an unholy melding of both tabs and spaces. With these three interpretations, the ASCII TAB character is essentially being used as a compression mechanism, to make sequences of SPACE-characters take up less room in the file. I don't think vi can do this, but I'm not sure. Most word processors can do this Emacs can do this. In many Windows and Mac editors, the default interpretation is the same, except that multiples of 4 are used instead of multiples of 8.Ī third interpretation is for the ASCII TAB character to mean indent to the next tab stop, where the tab stops are set arbitrarily: they might not necessarily be equally distanced from each other. This is also the default in the two most popular Unix editors, Emacs and vi. On defaultly-configured Unix systems, and on ancient dumb terminals and teletypes, the tradition has been for the TAB character to mean move to the right until the current column is a multiple of 8. neverending last-man-standing filibuster arguments about code formatting.Īnd there is no argument more evergreen than the timeless debate between tabs and spaces. A time when young programmers' minds turn to thoughts of.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |