Printer Friendly
Dictionary, Encyclopedia and Thesaurus - The Free Dictionary
1,763,290,803 visitors served.
forum mailing list For webmasters
?
New: Language forums
Dictionary/
thesaurus
Medical
dictionary
Legal
dictionary
Financial
dictionary
Acronyms
 
Idioms
Encyclopedia
Wikipedia
encyclopedia
?

syntactic sugar

   Also found in: Wikipedia 0.03 sec.

syntactic sugar

Certain coding rules in a programming language that make it easier for a person to write a program. For example, in Perl, the double dot operator is used to create multiple values. Writing ('A' .. 'Z') declares a range of values from "A" to "Z." In many other languages, each value has to be declared individually such as 'A','B','C' etc.

"Syntactic saccharin" is used synonymously with syntactic sugar; however, it also tends to refer to syntax that offers little or no value to the programmer, such as a symbol or word that is always required even though it adds no uniqueness to the expression. Contrast with syntactic salt.


syntactic sugar - Term coined by Peter Landin for additions to the syntax of a language which do not affect its expressiveness but make it "sweeter" for humans to use. Syntactic sugar gives the programmer an alternative way of coding that is more succinct or more like some familiar notation. It does not affect the expressiveness of the formalism (compare chrome).

Syntactic sugar can be easily translated ("desugared") to produce a program in some simpler "core" syntax. E.g. C's "a[i]" notation is syntactic sugar for "*(a + i)". In a (curried) functional language, all operators are really functions and the use of infix notation "x+y" is syntactic sugar for function application "(+) x y".

Alan Perlis once quipped, "Syntactic sugar causes cancer of the semicolon."

The variants "syntactic saccharin" and "syntactic syrup" are also recorded. These denote something even more gratuitous, in that they serve no purpose at all. Compare candygrammar, syntactic salt.


How to thank TFD for its existence? Tell a friend about us, add a link to this page, add the site to iGoogle, or visit webmaster's page for free fun content.
?Page tools
Printer friendly
Cite / link
Email
Feedback
? Mentioned in
 
Encyclopedia browser? ? Full browser
 
 
Encyclopedia
?

Disclaimer | Privacy policy | Feedback | Copyright © 2009 Farlex, Inc.
All content on this website, including dictionary, thesaurus, literature, geography, and other reference data is for informational purposes only. This information should not be considered complete, up to date, and is not intended to be used in place of a visit, consultation, or advice of a legal, medical, or any other professional. Terms of Use.