tirsdag den 28. juli 2009

What is an execution backend?

The latest Mascara release have improved support for changing execution backends, and now includes Mozilla Rhino as the default backend.

The execution backend is not a necessary part of the compilation/translation process and you can run Mascara fine without one.

However an execution backend is useful if you want to compile and execute the generated code in one step. This is especially useful if you have a set of unit-tests you want to run on the compiled code immediately after compilation.

Previously cscript.exe (Microsofts command-line version of JScript) were the default backend, but it is only available on Windows. Rhino is in Java, and will run on any system with Java, and since it is distributed as part of Mascara, you don't have to do anything extra to get it to work.

I still recommend cscript.exe above Rhino though. The reason is that cscript.exe reports line number and character position of runtime errors. This allows Mascara to trace back and find the corresponding position in the original source code, which makes debugging a lot easier. Rhino sadly does not always report line number of runtime errors.

The execution backend is invoked on the command line like this:

translate.py inputfile.esx --execute --backend rhino

The --execute parameter indicated that the translated code should be executed by the backend. The --backend parameter indicates the name of the backend (rhino or cscript). If the --backend parameter is left out, it defaults to the one specified in config.py (which is rhino by default).

Ingen kommentarer:

This blog has moved to http://blog.mascaraengine.com. See you!

This blog is (was) for news, announcements and questions regarding the
Mascara ECMAScript 6 -> JavaScript translator.