ID:152618
 
I've been looking over some material in Dream Maker while I've been bored recently. Why doesn't BYND require strict use of brackets and semicolens? I know they can be used, but they aren't a must

Doesn't this allow for some bad programming practices in later languages?
I used BYOND before java, and I do on occasion forget the brackets. However, it's not a major problem. (With an error, that's the first thing I look at - brackets.) So to answer your scond question - yes, kind of. However, it's not extreme or troublesome.


--Vito
In response to Vito Stolidus
I know what you mean, and this is a nice language for novices.

Another thing, it makes the code more un readable (IMO).
I think that the problem is the other way around: BYOND does it right, and it's all of those other languages that need to change...lol

All kidding aside, I suppose that BYOND might be making people lazy in this aspect of "professional" programming, but it shouldn't be too difficult to overcome later on...

Personally, though, I see no point in being stuck using brackets... To me it just clutters up the code, making it even less readable than non-bracketed DM style...

Of course, this only applies if you're writing code the way I do, with indented newlines for everything... I very rarely ever put things on single lines... for instance:

Rather than:
if(dead) MakeDead()


I'll (almost) always do:
if(dead)
MakeDead()


Throwing brackets into that just adds these extra, useless characters that interfere with the natural flow of reading the code...
In response to SuperSaiyanGokuX
SuperSaiyanGokuX wrote:
I think that the problem is the other way around: BYOND does it right, and it's all of those other languages that need to change...lol

Kidding or not, I agree with that 100%!
In response to Foomer
Well, I'm only half-kidding...

I actually do feel that BYOND's method is far superior, but I realize the folly of expecting the rest to change to conform to this little upstart...lol
I know they can be used, but they aren't a must

Nope BYOND reads scope and end of statements entirely through indentation so it isn't neccessary. Other languages like C allow for more free fromating but needs semicolons and braces to determine where statements end and scopes begin/end.

Doesn't this allow for some bad programming practices in later languages?

Not really. In fact it forces you to write clean code so hopefully you will continue to do so in other languages :P.
In response to SuperSaiyanGokuX
SuperSaiyanGokuX wrote:
I think that the problem is the other way around: BYOND does it right, and it's all of those other languages that need to change...lol

Having spent a lot of time in various different languages, I have to agree that BYOND's approach is the cleanest of any of them.

As for whether it helps people with future languages they might use...well, modern languages are moving in BYOND's direction. Python has a very similar syntax (but whimped out and still has some compiler syntax crud in it that BYOND got rid of), and the hottest language of the moment, Ruby, goes in this direction also.

It's my belief and hope that implementors of new languages are slowly coming to understand the benefits of not requiring the developer to insert lots of compiler syntax crud, and that they will evolve toward the BYOND approach before long.

Rather than:
> if(dead) MakeDead()
>

I'll (almost) always do:
> if(dead)
> MakeDead()
>


I have actually been moving in the opposite direction...simple one-liners I am more and more putting on one line. It makes it more like reading a sentence and, in my opinion, helps clean up the code.
In response to Deadron
Deadron wrote:
Python has a very similar syntax (but whimped out and still has some compiler syntax crud in it that BYOND got rid of)

If you're referring to the colons at the end of lines that start blocks, I actually like that (after initially disliking it). It makes it much easier to write code editors that automatically indent for you when necessary, with the result that any decent Python code editor will do this. Imagine how much harder it would be to parse otherwise. Sure, you could probably do it, but it wouldn't be trivial; and the colon makes it trivial, which makes it much more likely that people will do it. C/C++/Java can do this easily because they use braces, but DM has no equivalent.

In any case, I think it's cleaner than BYOND's brackets (which are C-inherited, so it's not all BYOND's fault). Compare:

// DM
for (var/X in somelist)


# Python
for X in somelist:


That's 3 pieces of punctuation per line for DM, as opposed to 1 for Python, and the Python line is easier to recognise as starting a block.

I'm not trying to say that DM's use of brackets is bad; I'm just saying that accusing Python of having extra "compiler crud" is slightly misleading when DM has its own, albeit different, crud. =)
In response to Crispy
But I feel that ()s are required, they make statements standout more. They allow me to see where my ifs start and end. I guess that is bracketism setting in, but still. I don't consider that crud but rather a nifty way of keeping code clean. I would still use ()s, even if BYOND nolonger required them.
In response to Scoobert
Scoobert wrote:
But I feel that ()s are required, they make statements standout more. They allow me to see where my ifs start and end. I guess that is bracketism setting in, but still. I don't consider that crud but rather a nifty way of keeping code clean. I would still use ()s, even if BYOND nolonger required them.

Me too. I tend to dislike code that removes them (in Perl you often have the option of skipping them, and I never do).

In addition, if I'm not mistaken, the mathematical function, which computer functions were designed after, also uses parenthesis...so unless those darn mathemeticians came up with that for the future benefit of compilers, it doesn't count as 'compiler crud'...
In response to Deadron
Python still requires brackets for functions (which as you say is a good thing). But I've never heard of the for() function in mathematics. ;-)
In response to SuperSaiyanGokuX
I <s>like</s> love white space, and backets, semicolens and the like.

All my loops look somewhat like this:

if(foo != 1)
{
stuff();
} else {
otherStuff();
}


Inplace of:

if(foo != 1)
stuff()
else
otherStuff()


Another thing. Why do the DM tags remove >>'s? Inplace of replacing them with four or so spaces, or just leaving them alone?
In response to Crispy
Never heard of sigma?
In response to Jp
Sigma isn't a for() loop. It's a summing function. Big difference.
In response to Smoko
Is it not clear that the second one is cleaner and more human-readable? To each his own I suppose, but still, your code is ugly.

But really, I don't see how people prefer all the extra stuff, seems like time wasted on pressing extra buttons and paying attention to pointless details.
In response to Scoobert
I've never had a problem moving from DM to PHP. And PHP requires semicolons and brackets(in places).

I suppose it could fall down to your compiler setup.
You could use different colours on each editor so, your memory will remember what syntax to use.

I, on the other hand, changed Notepad++ colours to the same as DM. So really, my PHP looks like DM.
In response to Scoobert
Is it not clear that the second one is cleaner and more human-readable?

To me, it's not as readable. My eye's don't like small ammounts of text like that. And I'm more used to looking at code like that

To each his own I suppose

I guess you're right.

your code is ugly.

:(. I've always thought it was nice and clean.

But really, I don't see how people prefer all the extra stuff, seems like time wasted on pressing extra buttons and paying attention to pointless details.

I like it, because it helps me see what goes where.
In response to Smoko
I have to agree, that is pretty ugly, if only because it isn't self-consistent. Your brace style is erratic.

if(foo != 1)      // Tomist style
{
stuff();
} else { // Danist style
otherStuff();
}


If you don't know what I mean by Tomist and Danist, you need to read the DM guide a little more closely. ;-)
In response to Crispy
Crispy wrote:
I have to agree, that is pretty ugly, if only because it isn't self-consistent. Your brace style is erratic.

It seems I'm by my self on this style.

I can't stand it when the oppening brace after an else statement is on a new line, or when the oppening brace after an if statement is the same line.
Page: 1 2