Here is a summary of recent changes since the last news roundup.
These apply to the SVN version, which will likely become 2.4 soon, as it includes quite a bit of improvements and fixes over 2.3 (which was released in march).
- Added support for initialization and finalization for units, unlike with Delphi, you’re allowed to declare variables in those sections.
- Added support for deprecated for properties.
- Delphi compatibility; accept “class helper” syntax, also added “interface helper” and “record helper“, which restrict the allowable types for a helper. Unqualified helper declaration is unchanged and still allows helpers on any type.
- Delphi compatibility: accept “reference to” and “of object” for function pointers/delegates declarations, the compiler just ignores them, as functions pointers are unified in DWScript.
- Added Swap() internal magic function, Swap(a, b) will swap the values of a & b as efficiently as possible, and works for all types (arrays and records included).
- Added StrToBool() to the standard functions.
- Added hint about private functions that are marked “virtual” (likely error, since they aren’t overridable).
- Added “pedantic” hints about parameters of class type that are passed as const.
- Fixed resolution of “=” and “<>” overloaded operators when applied to classes.
- Reduced compiled scripts memory usage (by 5 to 25%), also reduced script runtime objects memory usage slightly.
- Added an explicit lock to TDelphiWebScript to prevent multi-threaded compilation (multithreaded execution of compiled programs is not affected). A particular instance of TDelphiWebScript can only perform one compilation at a time, but you can have multiple instances of TDelphiWebScript to perform multiple compilations at the same time in different threads.
- Fixed a very rare bug in parameter passing that could occur for some combinations of parameters and memory allocations, it could result in spurious script errors that were almost impossible to reproduce.
- Fixed a bug with temporary space allocation for some methods
Support tools and classes
- Refactored and cleaned up the SourceFile list of compiled programs, fixed compiled line count for script involving includes and units.
- Fixed parsing of Unicode literals in the JSON support classes (characters specified by code rather than in the text)
- Fixed some methods in the SymbolDictionary that were case sensitive
Changes applying to SmartMS (for v1.0.1 and beyond)
- Devirtualization support, it allows a reduction of compiled JS size, and can give a small execution speedup. It also means it’s now harmless to mark methods as virtual even if they’ll only be very infrequently overridden.
- Date/Time functions are now supported on the JS side, offering a floating-point based date time which is compatible with TDateTime
- Fixed publishing of record properties that map to class functions, class vars or class consts
- Fixes and improvements for Integer() and Float() casts
- Fixed constructing sub-classed externale classes