- DelphiTools - https://www.delphitools.info -

Interfaces, build system, try..except..finally

There has been two major additions to Delphi Script in the SVN.

Interfaces

You can now declare, implement and use pure-interfaces in DWScript.

The “implements” operator was introduced for OO purity, since “obj is interface” is somewhat of an heresy from an OO point of view, so you’re encouraged to lobby for “obj implements interface” 😉

Finally, you can also acquire a function pointer/delegate from an interface method (something that Delphi doesn’t support, as of XE).

Build system

The “unit” support which was previously mentioned as experimental can now be considered operational.

DWScript supports classic Pascal units, with “unit”, an “interface” and “implementation” section, and when compiling a unit it enforces the usual restrictions, so you also have “type” blocks, as disambiguating type declarations is not necessary within a unit.

To feed unit’s code to the compiler, you can either use the “virtual file system” approach, or just handle the new OnNeedUnit event. In that event you have a choice of providing either raw source code or “ready-made” unit in the form of an IdwsUnit.

Other changes