DWScript 22.6.28 release

Periodic DWScript release 22.6.28 has been created on the DWScript GitHub.

This release includes a variety of micro-optimizations (many memory-related) for the compiler, runtime and JavaScript codegen, as well as fixes and improvements.

The language syntax has been slightly extended for the Pascal-to-Javascript transpiler to cover the case of read-only external properties.

The first extension allows to specify an external field name directly in a property declaration. After the read/write you just need the ‘external’ contextual keyword followed by the external name as a string

   JExternal = class external
      function SetRW(value : String); external 'setRW';
      property FieldR : Integer read external 'hello';
      property FieldW : Integer write external 'foo';
      property FieldRW : String read external 'world' write SetRW;

As it is still a property declaration, you can of course mix getter fields with setter methods etc.

The other experimental extension is a variation of the external method declaration

   JTest = class external 'foobar'
      function Test1 : Integer; external 'foo' property;
      function Test2(a : Integer) : Integer; external 'bar' property;

When the ‘property’ keyword is found after the external qualifier, then the method will be codegen’ed without parenthesis, and if it has parameters, brackets will be used instead of parenthesis.

This syntax is supported both for regular methods and class methods.

These syntax extensions should make their first appearances in the WebAPI repository over the summer… assuming they’re not superseded by a better syntax before 😉