Ever so often the term ‘syntactic sugar’ comes when people discuss language features, and it’s not uncommon to see the word ‘just’ right in

On syntactic sugar

submited by
Style Pass
2022-08-13 19:00:06

Ever so often the term ‘syntactic sugar’ comes when people discuss language features, and it’s not uncommon to see the word ‘just’ right in front of it; some examples:

The ‘just’ has a lot of meaning here. To me it suggests that language features that are ‘just’ syntactic sugar, aren’t quite as important as features that aren’t. Maybe it even suggests to me that the language would be fine without.

So while the above to examples both argue that both Javascript classes and async/await aren’t syntactic sugar, they also kind of come to the defence of those features and justify their existence. In other cases when people call something syntactic sugar, it’s often in a context that’s somewhat dismissal of the feature.

I think this is a bit odd and also confuses people, especially since any actual definition I’ve found is generally positive, such as this one from Wikipedia.

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 human use: things can be expressed more clearly, more concisely, or in an alternative style that some may prefer.

Leave a Comment