[net.lang] I Hate "Syntactic Sugar"

wsmith@uiucdcsb.CS.UIUC.EDU (09/09/86)

		I Hate (the term) "Syntactic Sugar"

One of the plethora of terms used in computer science is the term "Syntactic
Sugar."  As the title of this note suggests, I am not too fond of the term 
and would like to propose a substitute term.  As a point of history, when the 
world was created, there was no 'syntactic sugar', there were fructose, 
glucose, lactose, and probably lots of other sugars, but there was no 
syntose ('syntactic sugar').  As the world became more advanced, it became in 
need of other forms of sweets.  Chocolate was invented and the world was 
satisfied.  Unfortunately, computer scientists had an insatiable sweet tooth 
and after much cogitating, they invented the now world famous "Syntactic 
sugar."

What is wrong with 'syntactic sugar?'  Does it rot the teeth?  Does it add to 
the waistline?  Is it carcinogenic?   I doubt it.  One of the many products 
of the different scholarly disciplines is terminology.  If it is important, 
it has a name.  These names are completely arbitrary.  Naming conventions 
allow easier use of names when there are many names that are related within 
the discipline.  Unless there is a strong reason, when there already exists a 
good term for something, a new name is not invented.  That is what is wrong 
with 'syntactic sugar.'  It is a term that has a perfectly adequate 
synonym that has fallen into disuse because 'syntactic sugar' is (or in my 
opinion, was) a cute term.

What does 'syntactic sugar' mean?   It means the details used in
representing a complicated structure.  Originally referring to the syntax
of programming languages, it referred to things added to the syntax that made
it more readable or palatable to mortal humans who weren't able to read the
raw meaning of the program.  Palatable, to the originator of the term, meant
sugar, so we have syntax + sugar = 'syntactic sugar'.   Voila!  The term, 
usually used in the pejorative as in "That's only 'syntactic sugar.'  It's not 
important" refers to how an idea, concept, data item, or for computer science,
a program is represented.  The plain old, un-cute term for this is 'notation.'
The professor lecturing on the difference between C and Pascal could have 
just as easily said, "The THEN in an IF statement is only 'notation,' it isn't 
an important difference between the two languages."

What are the differences between the terms 'syntactic sugar' and 'notation?'
The word 'notation' can be found in the dictionary.  Students are familiar with
the term and when they hear the professor say it's 'notation', they can easily
fit the word into the context and understand the meaning.  On the other hand,
'syntactic sugar' is not a familiar term.  They must gather the meaning from 
the context which often does not always provide the correct meaning for the
term.  'Notation' may be a more general term than 'syntactic sugar,' but the
concept involved is the same.

I would like to propose that the term 'syntactic sugar' should fall into
disuse and disrepute to be replaced by the more clear and explicit
term 'notation.'

Bill Smith
ihnp4!uiucdcs!wsmith
wsmith@b.cs.uiuc.edu

gvcormack@watmum.UUCP (Gordon V. Cormack) (09/11/86)

The term "syntactic sugar" means to me "shorthand notation" or
"simplified notation" rather than just "notation".  For example
in a certain language, we might say "a + b" is syntactic sugar
for plus(a,b).

I don't find the term perjorative, except when applied by purists
who believe that any alternative forms obscure the "true semantics".
Most of us require a little syntactic sugar to swallow languages
that have a simple well-defined semantics; hence the term.

I do not claim that she is the originator, but I first saw the term
used by Barbara Liskov in describing array subscripting in CLU --
most of us could not tolerate calling a subroutine to do every 
subscripting operation and so the syntactic sugar of [] notation
was devised.

There certainly exist more fundamental differences between notations
than can be denoted "syntactic sugar".  The term should therefore
be preserved to mean trivial syntactic transformations.
-- 
Gordon V. Cormack      CS Department, University of Waterloo
uucp:  { allegra, decvax, ... }!watmath!gvcormack
csnet: gvcormack%watmum@waterloo
cdn:   gvcormack@mum.waterloo.cdn

shebs@utah-cs.UUCP (Stanley Shebs) (09/11/86)

Syntactic sugar has all the right connotations.  Syntax is insignificant
compared to semantics, but a little bit sweetens up what might otherwise
look distasteful.  On the other hand, lots of syntactic sugar will rot
your brains out.  I've had it up to here with trying to absorb the latest
random brain-damaged syntax of the latest language.  Some people really
get into it, but I think they should be kept away from parser generators
(Niklaus Wirth for example).

							stan shebs

keith@gargoyle.UUCP (Keith Waclena) (09/14/86)

In <598@watmum.UUCP>,  gvcormack@watmum.UUCP (Gordon V. Cormack)
writes:

>[...] I do not claim that she is the originator, but I first saw the term
>used by Barbara Liskov in describing array subscripting in CLU [...]

I believe the term ``syntactic sugar'' was first used by P. J. Landin
in ``The Mechanical Evaluation of Expressions'', _Computer Journal_,
6:4 (1964), 308-320.  Landin doesn't use the term at all
perjoratively.  He uses it to refer to notations that are more
readable than some lambda calculus notations.  For example, he
would describe the notation

	x * x
	where x = a * b + z

as a syntactic sugaring of

	(\x . x * x) (a * b + z)

(where ``\'' should be read as ``lambda'').

>There certainly exist more fundamental differences between notations
>than can be denoted "syntactic sugar".  The term should therefore
>be preserved to mean trivial syntactic transformations.

I think the term is most descriptive when one is referring to *any*
concrete syntax that could be used for a given abstract syntax.  In
this sense, all syntactic transformations are trivial.

Personally, I like the term.

-- Keith
----------------------------------------------------------------------------
Keith Waclena                       uucp:     ..!ihnp4!gargoyle!keith
Graduate Library School             CSNet:    keith@UChicago.CSNet
University of Chicago               Bitnet:   keith%gargoyle@UChicago.Bitnet

Disclaimer: Everybody around here thinks I'm crazy.
-- 
----------------------------------------------------------------------------
Keith Waclena                       uucp:     ..!ihnp4!gargoyle!keith
Graduate Library School             CSNet:    keith@UChicago.CSNet
University of Chicago               Bitnet:   keith%gargoyle@UChicago.Bitnet

Disclaimer: Everybody around here thinks I'm crazy.

bzs@bu-cs.BU.EDU (Barry Shein) (09/15/86)

I believe the following is attributed to Alan Perlis:

Syntactic sugar can give you cancer of the semi-colon.

(just a joke..)

	-Barry Shein, Boston University

gaynor@topaz.RUTGERS.EDU (Silver) (09/22/86)

[The line-eater eats 'em, the rest of us snort 'em.]

I neglect the references for brevity.  Please, no litigation! :-)

I don't like the term 'syntactic sugar' either.  It takes too long to
say, and has such a 'cutesy' feel to it...  I think I prefer
'syntose'.  Who originated it?

Whichever, I feel 'syntose' connotes more than just 'notation'.  As
the original poster states, "'Notation' may be a more general term
than 'syntactic sugar,' but the concept involved is the same.".  Nail
struck on head.  In a similar vein, we use the word 'compiler' instead
of the more general term 'translator'.

As has been pointed out by others, it gives the feeling of a syntactic
construct that has been added not out of necessity, but for elegance,
cleanliness, consistency with other notations, or other GOOD reason.
You be the judge what reasons are good.

In its real life analogy, it simply adds a certain attraction.  But
too much of the stuff isn't good for the obvious reasons, tooth decay
and obesity, but also for reasons not QUITE as obvious.  How would you
feel, say, if you had to eat a five pound bag of sugar?  How would you
feel if your entire diet consisted of sweets, only?

Food for thought,
Silver
  uucp
    ...!topaz!gaynor
              remus!gaynor
  arpa
    gaynor@topaz.rutgers.edu
    silver@gold.rutgers.edu
  real life
    In real life: ???

keithc@cs.qmc.ac.uk (Keith Clarke) (10/01/86)

Summary:

Expires:

Sender:

Followup-To:

Distribution:

Keywords:


Someone, I can't remember who, suggested that the term "syntactic sugar"
was coined by Peter Landin. I asked Peter, and he says that as
far as he knows he was the first to use it. He confirms that
his intention was to take a gentle dig at people who were
designing whizzo new programming languages by varying the
syntax and giving little or no thought to semantics.