ID:134592
 
How come spacing has to be a vital part of BYOND coding -_-
It can get very annoying at some point.
It isn't.

No, really, it isn't. But if you don't use indentation, you have to use braces and semicolons. Like the following:

mob {verb {Blarg() {world << "[src] blargs";}}}


Note that that should compile and run. But it looks ugly, doesn't it?

Several languages allow you to do that sort of thing - C and Java are the main ones. They use the same syntax of using braces and semicolons too.

But because looking at a page full of braces, semicolons, and funny words doesn't tell you where things are, people started indenting 'blocks' of code. Like in the following Java program:

public class Greeter {
public static void main(String args[]) {
System.out.println("This is a greeting");
}
}


The compiler completely ignores the indentation - it just looks at the braces and semicolons.

Dan and Tom decided that once you had indentation telling the programmer where blocks of code start and end, why couldn't the compiler read the same thing? It means less typing (You would do the indentation anyway), and it means the compiler and programmer are seeing the same thing in the same way, which is always a good thing.

And so, DM has an indentation-based syntax. Be thankful you don't need to add in braces or semicolons at the end of lines, and revel in your indentationess!
In response to Jp
and it means the compiler and programmer are seeing the same thing in the same way, which is always a good thing.

That is not always a good thing, I would venture to guess that programming very large projects(Like a word processor, art program, or even a game), compile times would be drasticly longer if ();s wheren't used.

I do like BYOND's system though, it is simple and easy, and doesn't for me to remember to put ; at the end of every line like most langauges.
Madow wrote:
How come spacing has to be a vital part of BYOND coding -_-
It can get very annoying at some point.

Spacing? Who taught you that? You should rather be tabbing. =/


O-matic
In response to Scoobert
What do you mean compile time would be longer if parenthesis weren't used?
In response to Loduwijk
This is a guess, but I think that it would be easier for the compiler would be able to compile quicker. I could be wrong, but that is why I always figured it was done how it was. DMs way seems way to logical to not be very common.
In response to Scoobert
It's just easier to write a parser that uses C-style rather than DM-style. I don't think it should impact the compile time very much. Also, some people prefer C's style, for some reason. I guess they're just used to it and like being inflexible.