• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Why doesn't Wurst use braces for all scopes?

Status
Not open for further replies.
Level 15
Joined
Aug 7, 2013
Messages
1,337
I've been haunting the Wurst tutorials and documentations found here: WurstScript • Legacy Map Guide.

From the examples I've seen, all the block ends use the very ugly "end" instead of open and close brace for declaration of things like functions, for loops, packages, etc.

Can someone explain why not to use braces ({}) for all blocks/scopes of code, or is there an option to do this in the Wurst IDE?

also: semicolons for ending statements would be good instead of a newline character or however the tokenizer works.
 

LeP

LeP

Level 13
Joined
Feb 13, 2008
Messages
539
because as long as the syntax isn't retarded it also mostly doesn't matter. who the fuck cares for end})
 
Level 15
Joined
Aug 7, 2013
Messages
1,337
It makes it a lot cleaner to nest functions/code/objects when the scope is ended with braces {} or even parens (). It's very normal to see multiple close braces next to each other, e.g. }}}, but how about a keyword like end? endendend? Not very readable.
 

Deleted member 219079

D

Deleted member 219079

Seems like Jurst offers an option to use end instead of end<block type>. Normal Wurst syntax follows the off-side rule, end is used only for closures.

It's like the Python way of doing things.

You can use Zinc if you insist on C-like syntax. (cJASS is unstable.)
 
I would honestly like to know why you are criticizing a dialect of Wurst that's supposed to look like (v)Jass for looking like (v)Jass? That's the whole point of Jurst (which is what you're criticizing).

If you want cleaner looking code, just use Wurst, not Jurst. Wurst uses python-like indentation, and the only time you have begin-end blocks is when you want to define an anonymous function (and if it is an one-liner you don't even need that).

also: semicolons for ending statements would be good instead of a newline character or however the tokenizer works.

But why would you need this?

This works:

JASS:
CreateUnit(
    Player(0),
    'hpea',
    0,
    0,
    0)

This is a bad example, but if you actually need to break a function like this, it is an option in wurst. Wurst's tokenization works fine, you can do lots of crazy stuff with it, in fact, so you don't need a semicolon to tell the compiler what to do.

Wurst will either force or inspire good practices on you by its design, and the way code is formatted is one of those things.
 
Last edited:
Level 15
Joined
Aug 7, 2013
Messages
1,337
I use Python daily for work but I guess I'd like a Javascript or Java style for Wurst or any preprocessing language for JASS. This becomes now an opinion and the developers of Wurst liked Python indentation over Java/Javascript braces. I guess if I were to develop such a language, I wouldn't care about having the code look like JASS and I'd make it look like Java/Javascript instead rather than Python.
 
Status
Not open for further replies.
Top