DWScript – October 2012 – 2.3 preview 2

A new DWScript 2.3 preview 2 7zip (422 kB) is available for download for those that don’t use the DWScript SVN. This version should be the last before a release candidate for 2.3. As the lead version is Delphi XE, users of Delphi 2009, 2010, XE2 and XE3 are especially encouraged to report any issues they encounter. FreePascal support is still considered experimental at this moment.

Language improvements

  • Introduce new root Object above TObject (see this article for details)
  • ‘_’ (underscore) is now allowed for formatting purposes in binary and hexadecimal literals, ie. you can write $DEAD_BEEF or 0b110_001_010
  • Script RTTI now supports published fields
  • Dynamic array parameters can now have [] (empty array) as default value
  • Added missing $HINTS PEDANTIC switch
  • Fixes for some cases of records holding sub-records
  • Fixed comparison of a meta-class against nil (previously only Assigned() was supported)
  • Fixed error message for HexToInt
  • Missing a semi-column at the end of a procedure prototype just before its implementation is now a warning rather than an error

Compiler and support libraries

  • language extension have a new StaticSymbols virtual method, which allows static symbols to be used even when language extensions are in use
  • dwsJSON Delphi 2009 compatibility fixes (thx Hallvard Vassbotn)
  • dwsJSON new AddValue() overloads, new jvtUndefined, minor speedups and other minor fixes
  • XE3 compatibility workaround (thx Steffen Binas)

Quick note about static symbols:

TdwsUnit has a StaticSymbols property, which when set to true will allow that unit’s symbols to be considered static by the compiler, ie. reused across multiple compilations.

When static symbols are not used (the default), each compiled scripts is self-sufficient, it holds its own copies of the symbol tables, and is sand-boxed from scripts compiled before or after it. When static symbols are used, the units with static symbols are shared across compiled scripts, which will speedup compilation and reduce memory usage.

When you enable static symbols, the TdwsUnit (and all it dependencies), is no longer allowed to change. You should also avoid manipulating the symbols and symbol tables (through reflections or symbol libs), unless you want those manipulations to affect all compiled scripts.

3 thoughts on “DWScript – October 2012 – 2.3 preview 2

  1. Static Symbols? Very nice! That’ll speed up compilation a fair amount.

    BTW would you mind looking at issue 303? Those AddValue overloads on TdwsJSONObject are nice, but TdwsJSONArray is conspicuously missing an equivalent functionality.

Comments are closed.