The worst insult ever?
Posted
#1
(In Topic #233)
Regular

It means: "You are so stupid, you must have been born that way."
The obvious inference is that using tabs in your source code is stupid, really really stupid.
Is that true? Well, yes.
There are two possible reasons for wanting to use tabs in your source code:
1) Save space in file storage
2) Being able to vary the depth of your indents simply by altering the tab settings of your editor
Neither can be justified.
Try out this code:
Code (gambas)
- ' Print #theFile, gb.Tab;;; gb.Tab; "F) Tab 2 Spaces Tab" ' That's a Syntax error
- Close #theFile
First thing to notice is that Gambas has a built in constant for the tab character. You should use it. You can't assume that people reading your code will know the ASCII value for the tab character.
The second thing is that Gambas allows ";;" as a delimiter that introduces a space between terms instead of packing them together. This can be handy for variables and expressions, but if the term on the left side of it is a string constant your code will look less cluttered if you insert a space inside the quote instead.
Now run the program and load the file in various editors/word processors. Notice the inconsistent results.
Indentation is a very important attribute of code readability/comprehensibility. (Easy to read/easy to understand) So much so that Python enforces it in order to be able to eliminate "end xxxxx" statements. Personally, I think it is a bad choice, but doesn't rise to the level of stupid. Using tabs in Python is particularly stupid.
But this forum is about Gambas, so let's continue.
My indentation rules for BASIC are as follows:
For "For" statements, I like two spaces. I used to use one. This is because For loops tend to be nested more than any other control structure. Tabbing with 4, or even 8 can quickly run the source code off the right side of the screen. Mild exaggeration.
Likewise, I use two spaces to indent the "Case" in a "Select" statement, and another two for the following code.
For "If" statements, I like to use three. This lines up the following code nicely, particularly when the same variable name leads the comparison and the following statement.
"Do" loops are like if statements.
(Side note: I like to use the "Do … Loop" for the five combinations: infinite, top while, top until, bottom while, bottom until. But that is a different topic and Gambas allows all of them.)
Back to the subject topic. Gambas uses spaces when you tab. Another good design choice. I haven't been able to find anywhere you can change that, another good choice.
On the other hand LibreOffice Macro Basic is the opposite. Hmmmmmm……….
If you think I am being stupid, call me out on it, let's liven this place up. Just leave my momma out of it.
Ced
.... and carry a big stick!
Posted
Administrator

Cedron said
Back to the subject topic. Gambas uses spaces when you tab. Another good design choice. I haven't been able to find anywhere you can change that, another good choice.
Tools > Preferences > Projects
Posted
Regular

Tools > Preferences > Projects
Dang, there it is. I turned it off first time, forgot where it was, forgot I did it. Reflexes sometimes get the better of me.
Wonder why it is under Projects and not under Editor. Shows I'm still a newbie at Gambas. Lots left to learn.
Thanks.
Almost forgot: Inc myPostCount
.... and carry a big stick!
Posted
Administrator

Top right hand corner of the post is a button with quote marks.Cedron said
Not sure how you quote within quotes…. So pretend I did.
You can also fine tune it for individual projects.Cedron said
Tools > Preferences > Projects
Dang, there it is. I turned it off first time, forgot where it was, forgot I did it. Reflexes sometimes get the better of me.
Wonder why it is under Projects and not under Editor. Shows I'm still a newbie at Gambas. Lots left to learn.
Thanks.
Almost forgot: Inc myPostCount
Projects > Project Properties > Options
Posted
Regular

Got2BeFree said
Top right hand corner of the post is a button with quote marks.Cedron said
Not sure how you quote within quotes…. So pretend I did.
You can also fine tune it for individual projects.Cedron said
Tools > Preferences > Projects
Dang, there it is. I turned it off first time, forgot where it was, forgot I did it. Reflexes sometimes get the better of me.
Wonder why it is under Projects and not under Editor. Shows I'm still a newbie at Gambas. Lots left to learn.
Thanks.
Almost forgot: Inc myPostCount
Projects > Project Properties > Options
Well, looky there. That little quote button is a lot easier that the quote button above + copy and paste I did the first few times. Thank you.
You sure are upholding this as being the friendliest forum on the internet.
Hmmmm, by project tab settings? For shared projects?
I don't know anything about using Gambas in a shared environment, but I would assume everybody would want tabs set to enter spaces, right?
Know anybody who wouldn't? Have you ever known anybody who wouldn't?
.... and carry a big stick!
Posted
Regular

Code (gambas)
- ' Print #theFile, gb.Tab;;; gb.Tab; "F) Tab 2 Spaces Tab" ' That's a Syntax error
- Close #theFile
1 guest and 0 members have just viewed this.


