Here is a quick summary of what changed in the SVN since the last update:
- array variables can now be initialized (with [] to enclose values), ie. the code below is now supported:
var abc : array [1..3] of String = ['a', 'b', 'c'];
abc := [ 'hello', 'world', '!'];
dwsClassesLibModule now exposes a minimalistic TStringBuilder.
added dwsRunner to the demos, a simple command-line runner for DWScript.
fixes to const parameters and constant arrays, though those don’t benefit from optimizations at this point.
trivial infinite loops are detected and warned about (repeat or while loops with an empty body and a constant condition).
upgraded dwsResult and dwsHTMLFilter to use TStringBuilder internally.
added MaxRecursionDepth to TdwsConfig, allows limiting the maximum number of recursive calls a script is allowed to perform.
various fixes and minor additions.
Your doing a wonderful job Eric, thank you!!
I was just looking at DWS. Very interesting script system you’ve got so far. One thing I wonder about, though. You have a compiler which produces a TdwsProgram object, but it seems to be of rather limited usefulness, since I’ve looked at TdwsProgram and it seems to be lacking the most important feature of a compiled language: delayed execution.
PascalScript has a compiler that inputs a string and outputs another string, containing bytecode that can be fed into the script executor object. You can save this script to a file, and load it up later and run it. But how do I save a serialized representation of TdwsProgram? There doesn’t seem to be a Save or a Load method.
There is no way to stream a TdwsProgram, and ther won’t be, mainly because serializing wouldn’t offer much in the way of practical benefits over re-compiling the source.
I’ll make a post on the detailed “WHYs” 😉