Here is a summary of the changes of recent happenings in the SVN.
Note that this list doesn’t include the very latest changes and features, which will get an article of their own.
- dynamic arrays now support Pop(), Peek() and Push() and can be used as stacks.
- dynamic arrays Add() and Push() now accept a variable number of parameters, and in addition to elements, they now accept dynamic arrays too (which will be concatenated)
- Count() can now be used as an alternative to Length() for static and dynamic arrays.
- Class variables are now supported, both by classes and records.
- Oxygene-like syntax for explicitly scoped “enum” and “flags” is now supported:
MyEnum = enum (One, Two, Three) MyFlags = flags (Alpha, Beta, Gamma)
Both forms must be prefixed, as in MyEnum.Two, the “enum” form is otherwise similar to classic enumerations. The flags form is a special case in which the elements values are powers of two (f.i. MyFlags.Beta = 2, MyFlags.Gamma = 4)
- class methods can now be marked as static.
- Class const syntax is now supported (had to be written as just ‘const’ before)
- multi-line indented strings can now be either #” or #’
- tweaked overload metric to give precedence to Float over Integer when Variants are involved
- added a new hint if you redeclare a variable with the same name in a local sub-scope (doesn’t apply across sub-procedures)
- improved some error locations, other minor fixes
Built-in functions and interfacing
- Partial RTTI support for indexed properties (Stefan Glienke)
- StrSplit() splits a string on a delimiter and returns an array of string
StrSplit(‘jan,feb,mar’, ‘,’) returns ['jan', 'feb', 'mar'] as a dynamic array
- StrJoin() takes an array of string and returns a string made by joining all the individual strings
StrJoin(a, ‘,’) with a the above array would return ‘jan,feb,mar’
- various improvements to the output when optimizing for size (about 10% of size reduction)
- fixed an issue with var parameters of a parent procedure used in a local procedure or anonymous method
- smart-linker is now capable of eliminating some cases of unused interfaces
- fixed an issue with aliased types used as record fields
- added fledgling code metrics classes
As a side note, the recent (and planned) improvements to dynamic arrays are currently tipping the generics vs templates balance towards templates, as they’re becoming capable enough “generic collections” on their own, meaning that “classic” generics wouldn’t bring much extra capability to the language for everyday usage.