XE2 / DWS 2.2, Rosetta Code, Operators
Quite busy times with Delphi XE2 news appearing all over the web!
DWScript 2.2 is planned for release a little after XE2 comes out, so sometime in September.
Goals for DWS 2.2 have been reached, so it’s mostly a matter of wrapping it up at this point, and tying loose ends. Expect Win64 compatibility, OSX/iOS compatibility will only be as far as the compiler checks go, as I don’t have no Mac to test upon.
I’ve begun adding some DWScript code to Rosetta Code, the snippets don’t just serve as illustration, but are also used for DWS unit tests, thus killing two birds with one stone.
Feel free to help in this endeavor!
Operator overloading is also now available, and can be applied to every types, classes included. You can currently overload all binary operators (+,*, etc.). The declaration syntax is as follows:
operator <op> ( <typeLeft>, <typeRight> ) : <typeResult> uses <someFunc>;
Operator overloading is considered a form of syntax-sugar, and treated as such, ie. you have to provide a regular function to handle the processing, the operator is just an alias for that function.
Also introduced are two extra operators ‘<<’ and ‘>>’, which can additionally be used at statement level (unlike regular binary operators). By default those two operators do nothing, they’re available for operator-overloading purposes only.
Other miscellaneous news
Other recent miscellaneous improvements in the SVN:
- The “new” operator for dynamic arrays now supports creating multi-dimensional arrays directly (arrays of dynamic arrays).
- New dynamic-array method: Reverse.
- New built-in functions: Factorial, ClampInt, ReverseString.
- Various bug fixes and extra code coverage tests (now at 87%).