Periodic DWScript release 22.6.28 has been created on the DWScript GitHub.
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
type 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; end;
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
type JTest = class external 'foobar' function Test1 : Integer; external 'foo' property; function Test2(a : Integer) : Integer; external 'bar' property; end;
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 😉