DWScript has supported several extensions to the Delphi language since the beginning. Here are a few you may wish the Delphi compiler supported too (and not just Delphi Prism…):
- generalized case of, which supports non-ordinal type, for instance you can write
case myString of 'hello': PrintLn('Hello!'); 'goodbye': PrintLn('See you!'); end;
- variables can be declared in-line anywhere in the script, allowing code like
for i:=1 to 10 do begin var k : Integer; ... end;
- variables are always initialized, not just global or managed variables
procedure MyProc; var k : Integer; begin ...k is guaranteed to be zero here (unlike in Delphi)
- variables can be initialized to custom values upon declaration
var obj : TMyObject = TMyObject.Create;