FACTOID # 23: Wisconsin has more metal fabricators per capita than any other state.
 
 Home   Encyclopedia   Statistics   States A-Z   Flags   Maps   FAQ   About 
 
 
 
WHAT'S NEW
 

SEARCH ALL

FACTS & STATISTICS    Advanced view

Search encyclopedia, statistics and forums:

 

 

(* = Graphable)

 

 


Encyclopedia > Syntactic sugar

Syntactic sugar is a term coined by Peter J. Landin for additions to the syntax of a computer language that do not affect its functionality but make it "sweeter" for humans to use. Often the implication may be that the speaker considers such features to be of little value. Ie, the phrase may be similar in spirit to the term "eye candy". Magnification of grains of sugar, showing their monoclinic hemihedral crystalline structure. ... Peter Landin is a British computer scientist. ... For other uses, see Syntax (disambiguation). ... The term computer language is a more expansive and alternate term for the more commonly-used term programming language. ... Look up Function in Wiktionary, the free dictionary The word function may mean: In common parlance, a role of a component in an assembly, or of an element in a systemic aggregate (such as a person within a group). ... Eye candy is an expression used to describe something that is most remarkable by its appearance, but that doesnt have anything else so exciting. ...


Despite possible derogatory attitudes, syntactic sugar gives the programmer (designer, in the case of specification computer languages) an alternative way of coding (specifying) that is often more practical, more conductive to a better programming style, or more natural to read. However, it does not typically affect the expressiveness of the formalism or permit the language to do something new. A programmer or software developer is someone who programs computers, that is, one who writes computer software. ...


Syntactic sugar can often be easily translated ("desugared") to produce a program (specification) in some simpler "core" syntax. In Landin's case, the core was a lambda calculus enriched with a few operations, such as assignment. Following Landin's insights, some later programming languages, such as ML and Scheme, were explicitly designed as a language core of essential constructs. The convenient, higher-level features could be desugared and decomposed into that subset. This is, in fact, the usual mathematical practice of building up from primitives. However many modern, "sugar-rich" languages (such as C#) cannot be desugared. Still, their features may be considered "sugar" because primitives exist in predecessor languages (such as C) to fully recreate them. The lambda calculus is a formal system designed to investigate function definition, function application, and recursion. ... ML is a general-purpose functional programming language developed by Robin Milner and others in the late 1970s at the University of Edinburgh, whose syntax is inspired by ISWIM. Historically, ML stands for metalanguage as it was conceived to develop proof tactics in the LCF theorem prover (the language of... The Scheme programming language is a functional programming language and a dialect of Lisp. ... Mathematics is commonly defined as the study of patterns of structure, change, and space; more informally, one might say it is the study of figures and numbers. Mathematical knowledge is constantly growing, through research and application, but mathematics itself is not usually considered a natural science. ...


One example of syntactic sugar may arguably be classes in C++ (as well as in Java, C#, etc.). The C programming language is fully capable of object-oriented programming using its powerful facilities of function pointers, type casting, and structures. However, languages such as C++ make object-oriented programming more convenient by introducing syntax specific to this coding style. Moreover, the specialized syntax works to emphasize the object-oriented approach to new programmers. Features of the C# (C Sharp) programing language, such as properties and interfaces, similarly do not enable new functionality but instead make good programming practices more prominent and more natural. C++ (pronounced see plus plus, IPA: ) is a general-purpose, high-level programming language with low-level facilities. ... Object-oriented programming (OOP) is a programming paradigm that uses objects to design applications and computer programs. ... The title given to this article is incorrect due to technical limitations. ...


Another example is in the C's handling of arrays. In C, arrays are constructed as blocks of memory, accessed via an offset from the array's starting point in memory. However, pointer arithmetic can often be "tricky," error prone, and ineligant. Therefore, C provides the a[i] syntax for what would otherwise be written as *(a + i). Similarly a[i][j] is easier to understand than *(a + i * n + j). C is a general-purpose, block structured, procedural, imperative computer programming language developed in 1972 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system. ... This article or section does not cite its references or sources. ...


Whether syntactic sugar is truly useful or just empty calories is probably a relative question and depends on the experience (but not skill) of the programmer. Experienced programmers who have integrated syntax patterns and overarching concepts in their minds will benefit the least, while new programmers will benefit the most.


The phrase "syntactic sugar" in itself usually conveys the attitude that these features are either unimportant or outright frivolous. For example, Alan Perlis once quipped, in a reference to bracket-delimited languages that "Syntactic sugar causes cancer of the semicolon." Alan Jay Perlis (April 1, 1922 - February 7, 1990) was a prominent U.S. computer scientist. ... Epigrams on Programming is an article by Alan Perlis published in 1982, for ACMs SIGPLAN journal. ... Curly brace or bracket programming languages are those which use balanced brackets ({ and }, also known as brace brackets or simply braces) to make blocks in their syntax or formal grammar, mainly due to being C-influenced. ... A semicolon (  ;  ) is a punctuation mark. ...


Indeed, even now the developers of such prominent projects as the Linux kernel insist on doing object-oriented programming using nothing more than C. So do the successive generations of programming languages bring anything new to the table that can't simply be refined through experience and skill? Yes and no. After all, shoes do not do anything that calloused feet cannot.


Nevertheless, it can be argued that changes that at first seem redundant may accumulate in evolution that, over the long term, leads to new functionality and paradigms. Indeed, we have recently developed shoes with springs.



Whatever may be said for the larger picture regarding the phrase 'syntactic sugar,' it is hard to argue that sugar makes important concepts (e.g. array manipulation or OOP) quicker to learn. Many important programs (desktop software or website-related) were coded by people who were relatively new to programming or who started coding seriously only to create their idea. Programming languages that make it quicker to master the concepts and tricks of computer science enable this sort of innovation. A shallower learning curve also tends to significantly benefit self-learners.


Syntactic salt

The metaphor has been extended by coining the term syntactic salt, a feature designed to make it harder to write bad code. Specifically, syntactic salt is a hoop the programmer must jump through just to prove that he knows what's going on, rather than to express a program action. Some programmers consider required type declarations to be syntactic salt. A requirement to write "end if", "end while", "end do", etc. to terminate the last block controlled by a control construct (as opposed to just "end") is widely considered syntactic salt. Critics from the opposite camp deride languages rich in salt as sadomasochism languages. For other uses, see Salt (disambiguation). ...


Syntactic saccharin

Another extension is syntactic saccharin, meaning gratuitous syntax which does not actually make programming easier. The skeletal formula of saccharin Saccharin is the oldest artificial sweetener; it was discovered in 1879 by Ira Remsen and Constantin Fahlberg of Johns Hopkins University. ...


Syntactic heroin

A column by Rodney Bates used the term syntactic heroin [1] for operator overloading, which he argues seem to simplify things at first, but then make programmers want more of it. Heroin ((INN) Diacetylmorphine, (BAN) diamorphine) is an opioid synthesized directly from the extracts of the opium poppy, Papaver somniferum. ... In computer programming, operator overloading (less commonly known as operator ad-hoc polymorphism) is a specific case of polymorphism in which some or all of operators like +, = or == have different implementations depending on the types of their arguments. ...


This finally ends up with a disaster, namely that code becomes very compact, but no human is able to analyze what the code actually means.


This article was originally based on material from the Free On-line Dictionary of Computing, which is licensed under the GFDL. The Free On-line Dictionary of Computing (FOLDOC) is an online, searchable encyclopedic dictionary of computing subjects. ... Bold text // “GFDL” redirects here. ...


  Results from FactBites:
 
syntactic sugar (99 words)
a[i] notation is syntactic sugar for *(a + i).
The variants syntactic saccharin and syntactic syrup are also recorded.
These denote something even more gratuitous, in that syntactic sugar serves a purpose (making something more acceptable to humans), but syntactic saccharin or syrup serve no purpose at all.
Syntactic sugar - Wikipedia, the free encyclopedia (674 words)
Syntactic sugar is a term coined by Peter J. Landin for additions to the syntax of a computer language that do not affect its expressiveness but make it "sweeter" for humans to use.
Syntactic sugar gives the programmer (designer, in the case of specification computer languages) an alternative way of coding (specifying) that is more practical, either by being more succinct or more like some familiar notation.
Syntactic Splenda is an extension to Syntactic Sugar, coined by Kip Porterfield.
  More results at FactBites »

 
 

COMMENTARY     


Share your thoughts, questions and commentary here
Your name
Your comments

Want to know more?
Search encyclopedia, statistics and forums:

 


Press Releases |  Feeds | Contact
The Wikipedia article included on this page is licensed under the GFDL.
Images may be subject to relevant owners' copyright.
All other elements are (c) copyright NationMaster.com 2003-5. All Rights Reserved.
Usage implies agreement with terms, 1022, m