Posted by
Dave Hakim
on 2003-02-03 12:34:14
Moto 0.18.0 includes a number of important features serious programmers will find indispensable.
Most prominent among these is the ability to get stack traces from exceptions in both interpreted
and compiled moto code just like you can get in Java or when using gdb.
So now running this:
| Will output this:
|
${
void evilOne(int depth){
if(depth > 0) evilTwo(depth - 1);
throw new Exception("Wheeee");
}
void evilTwo(int depth){
if(depth > 0) evilOne(depth - 1);
throw new Exception("Kaboom!");
}
evilOne(5);
}$
|
Uncaught Exception
message:Kaboom!
Exception thrown in evilTwo(1)(excp_trace_err.moto:9)
called from function evilOne(1)(excp_trace_err.moto:3)
called from function evilTwo(1)(excp_trace_err.moto:8)
called from function evilOne(1)(excp_trace_err.moto:3)
called from function evilTwo(1)(excp_trace_err.moto:8)
called from function evilOne(1)(excp_trace_err.moto:3)
called from function <main>(excp_trace_err.moto:12)
|
Don't worry, there has been only negligible impact on the performance of function calls.
Functions and methods in compiled moto apps still execute three times faster than they do in
Java (thats 10-30 times faster than they do in PHP,Perl, Python, or Ruby!)
Stack traces as well as other details of exceptions that get raised but not caught are now
output from the moto command line tool and written to the apache error logs from both the
interpreter module and mmc compiled modules. Also both the interpreter and mmc compiled modules
can be configured at runtime to catch signals raised during page execution and throw them as
exceptions (so you'll see a nice stack trace in your error log as opposed to a segfault message!)
New syntax constructs have been added to the Moto language with this release as well making programming in moto even more of a joy than it already was! Arrays can now be declared and defined anywhere from within moto code :
${ String[] happy = {"I'm","so","happy!"}; }$
| |
Programmers can now declare variables in the initialization section of for loops :
${ for(int i=0;i<10;i++) print "So so happy!\n"; }$
| |
A comma operator has been added allowing the code conciseness offered by compound expressions :
${ int i=1,j=1; while(i++,j*=10,i<5) print "I'm "+j+" times happier than I was a moment ago!\n"; }$
| |
And calls to macros that take arguments can finally span multiple lines!
Many other enhancements and bug fixes have been made including major enhancements to the command line options available to mmc! There's something for everybody in this release!
|