It is currently Sat Sep 23, 2017 8:17 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 39 posts ]  Go to page Previous  1, 2, 3
Author Message
PostPosted: Fri Apr 07, 2017 9:05 am 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10012
Location: Rio de Janeiro - Brazil
One reason I don't like to indent using spaces is that the more spaces you use (meaning this is much worse with 4 spaces than with 2), the easier it is to get the number of spaces wrong and end up with some lines not properly indented. You're only supposed to use multiples of your selected number of spaces, but nothing actually enforces that. And there's also the amount of disk space wasted on spaces, which might not be a big deal these days, but it still bothers me.

Tabs are not only cleaner, less prone to errors and more compact, but they're also semantically meaningful, since 1 tab = 1 indentation level. If you look at the file at the binary level, it just makes more sense.


Top
 Profile  
 
PostPosted: Fri Apr 07, 2017 3:31 pm 
Offline
User avatar

Joined: Thu Apr 23, 2009 11:21 pm
Posts: 783
Location: cypress, texas
Programmer's Notepad makes it easy... usually when pressing enter to start a new line, it will indent the new line so it is exactly lined up with the line from which the cursor came. If your current line starts with text at character 11, pressing enter starts a line underneath with the cursor at character 11. Character 11 is 10 spaces over; so if you pressed the spacebar ten times, typed some instruction, and pressed enter the next line would start with two tabs and two spaces.


Top
 Profile  
 
PostPosted: Fri Apr 07, 2017 4:15 pm 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10012
Location: Rio de Janeiro - Brazil
Yeah, lots of editors do that, but it's still very easy to screw up with the spacing when deleting, cutting, pasting, and so on. IMO you simply can't beat the "1 tab = 1 indentation level" equivalency.


Top
 Profile  
 
PostPosted: Sun Apr 09, 2017 2:14 pm 
Offline
User avatar

Joined: Thu Apr 23, 2009 11:21 pm
Posts: 783
Location: cypress, texas
... hmm... well, for me, using only tabs for indentation would cause some of my code and comments to be pushed over too far in the .lst file. Two spaces for indentation works extremely well for me. Maybe my code is indented too much... but it works well for me. :) That is excellent that using only tabs works well for you tokumaru; one tab is one character and is less than two spaces. It is pretty cool how each nes programmer has his or her unique preferences. :)


Top
 Profile  
 
PostPosted: Sun Apr 09, 2017 2:38 pm 
Offline

Joined: Wed Nov 30, 2016 4:45 pm
Posts: 84
Location: Southern California
I'm not familiar with your assembler, but you can probably set the line width for the .lst file so you don't get annoying wraps. I set mine to 160, the width in compressed mode for my dot-matrix printer which I use for programming because I want the fanfold paper and not split program structures at the page breaks. Also, if I want to just print a line or two at a time, I don't want it have to spit out the whole page, mostly blank, just to see the little I did print. I really only print .lst files though if I'm testing rather complex macros.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources


Top
 Profile  
 
PostPosted: Sun Apr 09, 2017 4:19 pm 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10012
Location: Rio de Janeiro - Brazil
unregistered wrote:
for me, using only tabs for indentation would cause some of my code and comments to be pushed over too far in the .lst file.

Nothing stops you from setting the tab width to 2 in a good editor like Notepad++, where the result would be indistinguishable from what you're used to. If you're more comfortable with spaces though, that's fine, every programmer works in their own way and there's nothing wrong with that.


Top
 Profile  
 
PostPosted: Sun Apr 09, 2017 8:25 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5643
Location: Canada
At least 2 spaces is only twice as many characters to edit as tabs. ;) I'd rather things be twice as bad than four.

I used 2 spaces myself for a long time. I think I stopped doing that when I got my first professional programming job and the convention there was to use tabs (rendered as 4 spaces); I guess I must have liked it.

Since then I've worked in some places that mandated spaces, some tabs, always 4-space though. I only tend to see 8-space convention in things like old open source UNIXish librarys, and 2-space seems a rarity... mostly in single-person projects?


Top
 Profile  
 
PostPosted: Sun Apr 09, 2017 8:27 pm 
Online

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19004
Location: NE Indiana, USA (NTSC)
For me the 2-space convention started in HyperCard, whose editor for HyperTalk scripts enforced 2-space indentation.


Top
 Profile  
 
PostPosted: Tue Apr 11, 2017 11:30 am 
Offline
User avatar

Joined: Sat Jan 09, 2016 9:21 pm
Posts: 201
Location: Central Illinois, USA
rainwarrior wrote:
and 2-space seems a rarity... mostly in single-person projects?


2 spaces is really common now in web-based and javascript development. They have stupidly deep levels of nesting (both with level-upon-level of nested html tags, and level-upon-level of callbacks and promises in javascript), so 4-space indents make things unreadable really fast.

Crazy kids.

_________________
My games: http://www.bitethechili.com


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 39 posts ]  Go to page Previous  1, 2, 3

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group