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. Sugar is a class of edible Crystalline substances mainly Sucrose, Lactose, and Fructose. Peter Landin is a British Computer scientist. He was one of the first to realize that the Lambda calculus could be used to model a programming language In Linguistics, syntax (from Ancient Greek grc συν- syn-, "together" and grc τάξις táxis, "arrangement" is the In engineering in psychology as well as in common parlance function denotes the property of something which is used/applied for an objective/ goal / Purpose / Scope Syntactic sugar gives the programmer an alternative way of coding that is often more practical, more conducive to a better programming style, or more natural to read. A programmer is someone who writes Computer software. The term computer programmer can refer to a specialist in one area of computer programming or to a generalist However, it does not typically affect the expressiveness of the formalism or permit the language to do something new.
Syntactic sugar can often be easily translated ("desugared") to produce a program in some simpler "core" syntax. In Landin's case, the core was a lambda calculus enriched with a few operations, such as assignment. In Mathematical logic and Computer science, lambda calculus, also written as λ-calculus, is a Formal system designed to investigate function Following Landin's insights, some later programming languages, such as ML and Scheme, were explicitly designed as a language core of essential constructs. 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 Scheme is a Multi-paradigm programming language. It is one of the two main dialects of Lisp and supports a number of programming paradigms but is 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. Mathematics is the body of Knowledge and Academic discipline that studies such concepts as Quantity, Structure, Space and However, many modern, "sugar-rich" languages (such as C#) cannot be desugared. C# (pronounced C Sharp is a Multi-paradigm Still, their features may be considered "sugar" because primitives exist in predecessor languages (such as C) to fully recreate them. tags please moot on the talk page first! --> In Computing, C is a general-purpose cross-platform block structured
Contents |
One example relating to variables is in the C programming language's handling of arrays. tags please moot on the talk page first! --> In Computing, C is a general-purpose cross-platform block structured In Computer science an array is a Data structure consisting of a group of elements that are accessed by indexing. 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 difficult, error prone, and inelegant. 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) + j).
A common feature of many programming languages is the ability to specify string literals directly in source code. A string literal is the representation of a string value within the Source code of a Computer program. The conventions for this vary, and there are some languages whose conventions are more restrictive than others. This is one example where proposals to change syntax in order to "save typing" has been characterized as "syntactic sugar". [1]
The C programming language is fully capable of object-oriented programming using its facilities of function pointers, type casting, and structures. Object-oriented programming (OOP is a Programming paradigm that uses " objects " and their interactions to design applications and computer programs However, languages such as C++ make object-oriented programming more convenient by introducing syntax specific to this coding style. C++ (" C Plus Plus " ˌsiːˌplʌsˈplʌs is a general-purpose Programming language. Moreover, the specialized syntax works to emphasize the object-oriented approach to new programmers. Features of the C# programming language, such as properties and interfaces, similarly do not enable new functionality but instead make specific programming practices more prominent and more natural. C# (pronounced C Sharp is a Multi-paradigm
Some programmers feel 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" (see Epigrams on Programming). Alan Jay Perlis (April 1 1922 &ndash February 7 1990 was an American Computer scientist known for his pioneering work in programming languages and the first recipient Curly brace or bracket Programming languages are those which use Balanced Brackets ( { and }, also known as "squiggly A semicolon (   ) is a conventional Punctuation mark with several usages Epigrams on Programming is an article by Alan Perlis published in 1982, for ACM's SIGPLAN journal The developers of the Linux kernel insist on doing object-oriented programming using nothing more than C.
The metaphor has been extended by coining the term syntactic salt, which indicates a feature designed to make it harder to write bad code. Salt is a Dietary mineral composed primarily of Sodium chloride that is essential for Animal life but toxic to most land plants Specifically, syntactic salt is a hoop the programmer must jump through just to prove that he or she 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" or even simpler syntax using braces "}") is widely considered syntactic salt.
Another extension is syntactic saccharin, meaning gratuitous syntax which does not actually make programming easier. Saccharin is an Artificial sweetener. The basic substance Benzoic sulfinide, has effectively no Food energy and is about 300 times as sweet as
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 The GNU Free Documentation License ( GNU FDL or simply GFDL) is a Copyleft License for free documentation designed by the Free Software