Julie Andrews, as Mary Poppins, sang "Just a spoonful of sugar helps the medicine go down." The "Spoonful of Sugar" song starts "In every job that must be done, there is an element of fun. You find the fun and snap the job’s a game". When I am programming, I am having fun. Yes, it is also a job, but, creating software is a job, a game, and total fun. In programming languages, some people might claim that certain language features are "syntactic sugar". The claim is that syntax was added to make the language look cool, but adds little value to making programming easier.
As I am talking with developers about programming language features and extensions, I immediately as the person to describe what programming problem they are trying to solve. If language syntax can help, then I am all for adding the capability. Consider the interface syntax, for example, that was added to Embarcadero Delphi way back in version 3.0. Of course, it is cool to add interfaces to an object or non-object oriented language. An interface specifies a pre-defined agreement between an object and other objects, services, and systems will eventually implement the interface.
Adding Delphi interfaces solved some real programming challenges of COM programming and simplified what a developer had to program by hand (note: Microsoft introduced their Com+ programming simplification years later). Interfaces allow you to define objects in an implementation independent way. Interfaces were also useful later for web services programming where the implementation is detailed in the web service on some computer. While the early Delphi interfaces were directly tied to COM (IUnknown), you can also create pure interfaces.
Other developers have asked us to support multiple inheritance, like in C++. With interfaces, Delphi also supports multiple interface inheritance. I believe this is a much better capability without some of the difficulties of multiple inheritance. The Java language also supports interfaces.
Operator overloading was also labeled sugar coating by some developers. But, seeing operator overloading in other languages and their use to create more reusable objects and extend the reach of operators to class methods, iterators, generics, and more. The C++ programming language contains a wide array of enhancements above and beyond the C programming language. While some developers will point to C++ syntactic sugar elements, I agree with the ISO C++ committee and BJarne Stroustrup, that every addition to the C++ language continues to make the language better for building libraries, system programming, make the language easier to teach and learn, and continue to make programming safer, more powerful and flexible. We are happy and proud to continue to enhance C++Builder to support the evolution of C++.
If you like your programming sweetener to be syntax, libraries, frameworks, application platforms, sugar, honey, sucrose, dextrose, lactose, fructose, aspartame, sucralose, splenda, or saccharin, I am for it. I will gladly add sugar to my programming ingredients. What programming language syntax would you classify as sugar? What programming language extensions would you like to see in future versions of the Delphi compiler?
For now, you’ll have to wait a short while longer for some of Embarcadero’s new sugar. Stay tuned to the Embarcadero web site for the next generation in business application development.