Background
The Wikipedia page on Syntactic Sugar states:
In computer science, syntactic sugar is syntax within a programming language that is designed to make things easier to read or to express. It makes the language "sweeter" for humans to use: things can be expressed more clearly, more concisely, or in an alternative style that some may prefer.
I don't really understand what the difference is between Syntactic Sugar and Syntax.
I appreciate the point that the sugary version can be clearer, more concise, perhaps boil off some boilerplate. But I feel at some level, all the syntax is essentially doing that to form an abstraction over what the code gets compiled down to.
From the same Wikipedia page:
Language processors, including compilers, static analyzers, and the like, often expand sugared constructs into more fundamental constructs before processing, a process sometimes called "desugaring".
As a thought exercise, if I take "often" in this statement to mean "always": If the difference were just whether the compiler "desugars" the syntax before moving to a next stage, how might a coder who does not know the innards of the compiler know (or care) what is Sugar'd Syntax or not?
A very much related question on this site "Rigorous Definition of Syntactic Sugar?" has an answer which commences:
IMHO I don't think you can have a definition for syntactic sugar, because the phrase is BS and is likely to be used by people that talk about "real programmers" using "real tools" on "real operating systems"
Which might indicate to me that perhaps there isn't a huge difference to the coder using the language? Perhaps the difference is only perceptible to the compiler writer? Though there may be instances in which it's helpful for the coder using the language to know what's under the hood of the Syntactic Sugar? (But perhaps in reality any discourse on the subject tends to use the term as flame bait?)
The heart of the question
So... the short version of the question:
- Is there a real difference between Syntax and Syntactic Sugar?
- Who does it matter to?
Extra Food for Thought
Bonus on topic contradiction:
On the Wikipedia page an example is given:
For instance, in the C language the
a[i]
notation is syntactic sugar for*(a + i)
Whereas another answer on the above linked question talks about the same example:
Now consider
a[i] == *(a + i)
. Think about any C program that uses arrays in any substantive way.
And summarizes that:
The
[]
notation facilitates this abstraction. It's not syntactic sugar.
The opposite conclusion for the same example!