Below is a quick summary of changes in the SVN since the last post.
There is also a mini-sneak peek of things to come!
Recent changes
Language changes
- Arrays can now be concatenated with the ‘+’ operator (same as XE7), note that it is supported for static arrays too, but a concatenation of static arrays results in a dynamic array.
- The ‘+=’ operator is now supported by dynamic arrays as syntax sugar for the Add() pseudo-method, so you can use it to concatenate either another array or an element.
- “library” is supported as an alternative to “program” for the main program, the script engine exposes it but currently gives it no particular meaning.
Changes relative to SmartMS (for next version)
- introduced support for anonymous classes
- improved the JS codegen to minimize dependencies to TObject when only JObject or external classes are used
- initial support for scripting the JS codegen (see sneak peek)
Fixes
- Fixed a scoping issue for helpers across units (which in some circumstances were no longer helpful)
- Fixed edge case issues with overloaded methods & visibility
- Fixed an edge case issue with accessing a dynamic array element directly from a function returning a dynamic array
- Fixed suggestions which were failing in some case
Internal changes
- script interfaces & dynamic arrays are now handled internally distinctly from scrip instances, previously they were using a common (Delphi-side) interface
Sneak peek
Well, sneak peeks new bits actually 🙂
You may remember that the SmartMobileStudio [1] command-line compiler was released for free [2] sometime ago, in the next DWS WebServer the JavaScript CodeGen will be available as well (in pre-compiled form), allowing to use Pascal both server and client-side auto-magically!
The other tidbit is that the JS CodeGen is now becoming scriptable! this means that what the CodeGen generates can be customized by scripts, so you can perform case-specific code generation.
The first use case for this is going to be server-side compilation of static Mustache [3] or Handlebars [4] semantic templates. This allows to write and maintain regular templates, and have them them compiled to straight JS when they’re static, with no parsing of the template on the client-side.