From an interview with Anders Hejlsberg:
Q: "Some people in the C academic community don’t like the idea of operator overloading. Some people call it 'synthetic poison', not only 'synthetic sugar'"From an M.S. thesis supervised by Bertrand Meyer:
"Enumerations are nothing else than synthetic sugar for classes extending java.lang.Enum"And various, less notable sightings:
- "With C# 3.0 you can use synthetic sugar to write less code"
- "Trigraph characters are 'synthetic sugar' which is handled by the preprocessor"
- "In the end, aren't all programming languages basically just synthetic sugar, on top of machine code (from an engineering perspective), or on top of a Turing machine/lambda calculus equivalent (from a theoretical perspective)?"
- This last example is very interesting because the author got it right 3 out of 4 times.
Like all eggcorns, the logic behind this error is self-evident. Dietary synthetic sugars are manufactured as nonnutritive additives to sweeten food while adding little else (most hopefully not calories!). Syntactic sugars are analogous in that they're added to the language by designers to make it "more palatable" to programmers, while adding absolutely nothing to its overall expressive power.
A parallel may also be drawn between the artificial nature of synthetic sugars and the superficial nature of syntactic sugars, and all the negative connotations that follow from such labels. This angle, though more speculative in nature, is perhaps demonstrated by the programming epigram "syntactic sugar causes cancer of the semicolon".
Submitted for your consideration!