Want more...Sugar

Posted by on in Blogs
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.

Gold User, Rank: 1, Points: 2466
David Intersimone (known to many as David I.) is a passionate and innovative software industry veteran-often referred to as a developer icon-who extols and educates the world on Embarcadero developer tools. He shares his visions as an active member of the industry speaking circuit and is tapped as an expert source by the media. He is a long-standing champion of architects, developers and database professionals and works to ensure that their needs are folded into Embarcadero's strategic product plans. David holds a bachelor's degree in computer science from California Polytechnic State University at San Luis Obispo, California.


  • Guest
    zeroc8 Monday, 18 July 2011

    I would like to see something like goroutines and channels to ease concurrency. Syntactic sugar for memory management a la IOS5 (no more manual retain/release calls required) would be quite nice too.

  • Guest
    Heinz Z. Monday, 18 July 2011

    I want ... more speed in developing syntactic sugar for Delphi. At the moment Prism make the pace. All is welcome which helps to show more clearly what the programmer is trying to achieve.

    A "case" for strings is simple example: Everybody knows how to implement that with an "if-then-else" chain. But for an "if-then-else" chain I have to check every condition before I can be sure its a real "string-case" replacement. On the other side I can get the same information from one single line. So I miss a "string-case". :-)

    An other example is interfaces with a protected area. At the moment I can't hide the setters and getters of interface properties. When I uses properties the numbers of identifiers explode by factor 3. With properties the user of an interface always has 2 ways to set or get a property value. But that is not what the programmer try to accomplish. So I miss a protected area for interfaces. :-)

  • Guest
    Kashif Monday, 18 July 2011

    I do hope linq is in your todo list.

    It would be cool if we can add an image of a class instead of a box, to the class diagram. This will immediately convey the meaning to the observer. A customer class has a customer image/icon, similarly a product has a product image/icon.

    How about a next gen datamodule. which shows connection lines between components.
    Just from the top of my head :).

    Move more and more towards automatic code generation for the entire application (especially multi-tier).
    This should increase productivity tremendously.

  • Guest
    Kashif Monday, 18 July 2011

    One more thing, we need framework to build Browser based HTML5 websites/Webapps that rival flash/silverlight but are made in delphi win32.

  • Guest
    Macedonczyk Monday, 18 July 2011

    Interfaces without reference counting

  • Guest
    David I Tuesday, 19 July 2011

    Kashif - check out TChromium - component to interface to Chrome runtime. You can use it to build HTML applications for Win32.



  • Guest
    Ken Knopfli Tuesday, 19 July 2011

    The WITH statement has long been derided as "syntactic sugar".

    Properly implemented, it is a truly useful tool, meaning less typing and helping readability (as currently implemented, the opposite is the case)

    People have posted several realistic suggestions for many years in the QA.

    I understand there are implications for the debugger, but it is worth it.

    In Borland Pascal 7, we at least had the error message that the value cannot be displayed. Now we get the value of the same name in the "root". Totally misleading.

  • Guest
    Fabricio Tuesday, 16 August 2011

    If WITH followed an sintax like:
    with a:Object1 do
    Would be much as useful and without the issues it have today.

  • Please login first in order for you to submit comments
  • Page :
  • 1

Check out more tips and tricks in this development video: