Some months have passed since I wrote the recent and first article about my own scripting language JASS++.
By meantime, the language specification has become much improvement (old version 607 lines, current version on my local computer 2344 lines).
I’ve added things like templates, container types, AI blocks, preload blocks, local blocks, exception handling, declaration requirements, object type literals and those in strings, locking, function types and variables, lambda functions, enumerations, aliases, finally, friends, serialization and a standard library.
All in all the language has become bigger and harder to implement but also more logical.

For better understanding why I’ve specified so many new features I’ve created some code examples which compare JASS, vJass and JASS++ solutions.
Container types specification helps you to use types such as force, group, string, arrays and enums. In addition to the possibility to use the “size” keyword an those types you could use “foreach” keyword for iterating them safely.
Using keywords like “executewait”, “sleep” or “wait” helps you to get some delayed statements, synchronized or using local time.
Furthermore “local” can be used to create synchronized statement scopes for local code and provide something safer than just those Blizzard comments used in their own code when checking for local player by using “GetLocalPlayer”.
Aliases are useful when providing new identifiers for existing stuff without reimplementing it.
Templates should be known from C++ since they are declared (and probably compiled) very similarly.
AI blocks can be used for creating custom AI scripts with some more safety (since there are various rules to create working AI scripts.
Function types and lambda functions should also be known from other programming languages and vJass. JASS++ uses keyword “abstract” for function types declarations. Finally, known from Java, helps you to clean some memory without saving results into local variables and returning them at the end of your function. Serialization provides a standardised way to save values (also class objects and arrays!) into hash tables and game caches and of course to load them from.
Conditional statements and loop statements do behave some differently than in common programming languages.
“switch” statements will be recalled until a value is being returned or “break” is being used.
Loops can have “case”, “default” and “else” statements, too (Python inspired me to add those since it allows you to use “default” and “else” for loops). “case” needs an integer expression and will be used when the loop was iterated as many times as the integer expression pretends. “default” will be used when the loop has not been stopped by using “break” otherwise your optional “else” scope will be used.
Scopes has been specified much more precise than before. The language allows you to declare nested scopes like C++, so you can declare classes in class declarations etc.
It is also allowed to access static variables of functions if they are public.
Additionally you can use access modifiers to make declarations usable by its outer scopes. For this reason theoretically it is possible to write something like package package package package public void test() {} If your function is declared inside 5 (not 4 since first is used implicitly) nested packages. Friend declarations can be used to allow some advanced access to declaration which are not in the same scope branch and can also be used in functions for static variables. Enumerations are not necessarily integer-based and there is some specific rules on how enumerations which inherit native types like “playercolor” do get their values. Object type literals are a useful way to get some data from SLK and w3o-based file data of the map and its corresponding game MPQ archives.
They can also be used in strings (like in object editor – tooltips). Declaration requirements is an essential feature since you can only use functions before their declaration by using “execute”, “evaluate” and “executewait” which can only be used on threaded functions.
One of my first ideas when I started creating initial drafts of JASS++ was to handle declaration requirements automatically but I discarded everything since I’ve always hated such implicit invisible declaration order behaviour and preferred some explicit statements so developer can see which function or package is used/required. I think this can be discussed a long time and surely would sometimes be much easier without explicit statements but actually if you split up your code into several packages you won’t have to use more than package identifiers as declaration requirements anymore to make sure everything will work correctly.
Note that vJass does only provide “requires” for libraries and does also auto generate “.evaluate” for methods if you don’t disable this behaviour.
At the moment I am working on some parts of the specification which are still inscrutable or not precise. Actually I wanted to create some LaTeX based documentation split up into several documents but it seems that I have not enough time for doing this next days.
First I want to rework or initially write the multi inheritance specification which I have already some drafts for but did not add yet.
It probably will be very similar to C++ since I’ve read the C++ documentation when I created my drafts and for sure I am a real C++ fan.
I’ve also added keywords “type”, “var” and “function” to allow users making their code more readable and also for template type interfaces/constraints.
Another big advantage of JASS++ will be its standard library. This is maybe one of the most discussible parts of any language. Although I won’t discuss much since I’m the only one who really cares anyway and I have some experience with JASS and vJass by now.
Some parts of my project ASL will be used reimplemented by using JASS++ syntax and some of its language features but I will separate everything into API modules like described in “common.j” file split up into packages.
There will also be classes for native types and some more specified systems like an RPG’s ones for inventories and characters.
You can find the current version of drafts and the German specification itself as linked above on my brother’s server since I had some file system corruptions and do not use my SVN repository at the moment until I fixed everything.
If you want to contribute something, please do it. I really don’t care if it’s crap as long as I can laugh about it.
Just write comments or an e-mail.
Btw. I’ve revised the specification while I was writing this article. It has 2396 lines now (before 2344) since I had to revise friends, access modifiers and scopes sections which were some kind of misty.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: