Version 9 of Synergy/DE was released today. Congratulations to the Synergy/DE team on the successful culmination of years of effort, resulting in one of the more important releases in their history. Disclaimer: Synergex is a customer of mine.
The most striking new feature in the language is the incorporation of full object-oriented syntax, including inheritance (naturally), public/private/protected accessibility, parametric polymorphism, and operator overloading, all in a very language-natural syntax. OK, a lot of you out there are saying, “well, we’ve had all that in language XYZ for n years” and you’d be right.
What I like about the OOP support in Synergy/DE is that it isn’t forced. You can still program in procedural statements without classes if you wish, and you can mix procedural and class-based code freely. The purists out there are frowning, but I’m smiling. OOP can be mighty useful, but there are sometimes when all you want to do is drive a nail, without constructing class hierarchies for the nail, the wood, the hammer, and the builder. You don’t have to create an Application class just to print “hello world”.
Parametric polymorphism (that’s an alliterative polysyllabic buzzphrase for “you pass different kinds of arguments, you call a different routine”) requires a degree of static typing. But again, Synergy/DE has avoided going overboard like Java and C#. You can get as specific as you like about the type, direction, and requirement of each argument — or you can leave any part of that undefined. For type, not only can you specify @* (any type of object), you can also specify “any” (any type of object or primitive type). It’s up to your routine to handle that argument correctly, but it gives you so much more power and agility than having to always force your routines into a static typing model.
A new utility, dblproto, can be used to register prototypes for your routines, based on their declarations in the source code. That allows consumer routines to import the namespace without having to include any files, and saves you from publishing sources if you don’t want to. You can prototype both classes and stand-alone functions and subroutines, so again you don’t have to use OOP to get the benefit of static typing, if that’s what you want.
Synergy/DE, and the DIBOL language on which it was originally based, always had a context-based grammar. Any keyword could be used as a variable name or a routine name, because the context in which it appeared defined how to interpret it. Therefore, the XCALL statement was required when calling a routine for which no return value was desired, and a % had to precede a function invocation that returned a result. Thanks to prototyping, the compiler can now be smarter. Most routines that are prototyped can be invoked without the XCALL or the %, which can make the code much more readable.
Because of its COBOL heritage, Synergy/DE had always required that variables be declared in a data division at the top of a routine. In version 9, a new DATA statement has been added to declare data within a BEGIN-END block, having the scope of that block. That means that if you just need a local work variable, you don’t have to clutter the data division, and it will help avoid the often dangerous reuse of the same variable for different purposes. Moreover, when creating an object, if a reference to the object does not get passed out of the BEGIN-END block, the object will get cleaned up on loss of scope.
Other new features in this version of the language include a much cleaner syntax for handling dynamic arrays and mapping structures to variables, as well as a true “string” type in addition to the traditional alpha (which is essentially a statically sized char array).
These new features finally bring Synergy/DE fully into the class of languages that support OOP, with a syntax and capabilities that are better than many in that class. This is the realization of a dream that Ken Lidster, myself, and others have shared (and pursued) for more than sixteen years. Given that the language has for a long time now supported the ability to pass functions as parameters (via xaddr/xsubr), Synergy/DE is evolving into one of the more powerful languages available for business application programming.
So what’s next, closures?