SynEdit DWS Highlighter, Unicode Identifiers, Type refactorings

Here is a summary of recent changes for DWScript SVN-side:

  • A syntax highlighter for SynEdit (Unicode version, available in SynEdit’s SVN) is now available, it introduces support for DWSScript specific features (keywords, string delimiters…). It is essentially a fork of the Pascal syntax highlighter.
  • Unicode identifiers are now supported, though as always with Unicode identifiers, it may not be too wise to use them too much if you want to keep the scripts maintainable. It allows to access exposed classes or libraries that use Unicode identifiers themselves.
  • The type system refactoring is in progress, most of the changes are purely internal, a handful of corner-case bugs were spotted and fixed in the process.
  • Compiler will now hint about variables that are never written to (when coSymbolDictionary option is set).
  • Inc/Dec/Succ/Pred are now magic functions, and will return the correct type when invoked on an enumeration.

Static classes, quote-delimited strings, final, hints/warnings

Here is a quick summary of recent changes SVN-side for DWScript:

  • static classes are now in DWS, like the Prism/C# variant, they are classes which cannot be instantiated and can only have class methods or properties, but as DWScript supports the concept of meta-classes, unlike in Prism/C#, they can be virtual and sub-classed (unless you mark them as “sealed” too, of course).
    type
       TStatic = class static
          class procedure Whatever;
       end;

    Note that a static class can only be subclassed to a static class, and can only inherit from a static class (or TObject).

  • quote-delimited strings can now be used as an alternative to apostrophe-delimited strings as in JavaScript and Prism, though they are still single-line strings, like in JS and unlike in Prism.
    var hello := "bonjour l'ami";
  • the final qualifier is now supported, it can be used to indicate that a method can no longer be overridden by subclasses.
  • the compiler will now warn about invoking constructors on instances (rather than classes) when outside of a constructor.
  • method override checks have been made stricter and compiler should now report all cases of incorrect overrides.
  • new directives {$HINTS ON|OFF} and {$WARNINGS ON|OFF} are now supported, and allow to turn on/off the hints and warnings respectively.