XE2 / DWS 2.2, Rosetta Code, Operators

Quite busy times with Delphi XE2 news appearing all over the web!

DWScript 2.2

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.

Rosetta Code

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

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%).

4 thoughts on “XE2 / DWS 2.2, Rosetta Code, Operators

  1. Glad you’re adding to RosettaCode. I hope you don’t mind me translating some of your DWScript entries into Delphi examples.

  2. Je suis désolé de poster ici, mais j’ai cherché partout sur le site un lien de contact sans succès. De plus, le forum est fermé.
    Ma question est:
    DWS est il compatible UTF8 ?
    J’essaie avec un script très basique:

    println(‘?????????’); // caractère thai

    et le résultat est: ?????????

    J’utilise delphi xe et dws 2.1

    Merci de votre aide,

  3. @yarek
    Yes, DWScript is Unicode & UTF8 capable. For you case (Issue #127), I can’t reproduce the issue, I even added it to the standard unit tests suite just to be sure.
    Chances are that whatever you’re using to display the result isn’t Thai or Unicode-capable (encoding issue?). For instance when adding the test I found that NotePad++ wouldn’t support Thai but Notepad worked.

Comments are closed.