DWScript 2.1 preview 3 – now with type inference
A DWS 2.1 preview 3 7z archive is available at googlecode Delphi Web Script page, you can also get the same code via SVN of course.
This versions fixes several reported and unreported issues, and adds support for type inference and Delphi Prism variable initialization syntax. Before you could write code like:
var myInteger : Integer = 1234; var myObj : TSomeObject = TSomeObject.Create;
where ‘=‘ was used as assignment operator (using the same syntax as for constant declaration or default parameter values), you can now write the above using ‘:=‘ as well
var myInteger : Integer := 1234; var myObj : TSomeObject := TSomeObject.Create;
and you additionally can make use of type inference and write just
var myInteger := 1234; var myObj = TSomeObject.Create;
Type inference is currently limited to the variable declaration, this will probably stay for code clarity (opinions?). The inferred type isn’t restricted at the moment, but that will probably change (so you can disallow to inferring to a Variant type f.i.).