OdeToCode IC Logo

Ted’s C# 3.0 Overview

Thursday, September 22, 2005

Ted Neward has a great post analyzing new C# 3.0 features.

Ted refers to the language enhancements as mostly “syntactic sugar”. In other words - the syntax additions don’t change the expressiveness of C#, but merely add conveniences and shortcuts. We write less code while the C# compiler generates more IL behind the scenes.

Over the years I’ve been puzzled by the term ‘syntactic sugar’. People generally use the term in a derogatory sense, as in: “C++? Pffft. That’s just C with some syntactic sugar”.

Isn’t every language just syntactic sugar when compared to, say, CPU opcodes?

optionsScalper Thursday, September 22, 2005

I know my understanding of the definition of Landin's term "syntactic sugar" and it is essentially this:


I find wikipedia's definition practical, but not rigorous and I am unaware of Landin providing rigor.

I just commented on Ted's Blog to see if he could clarify this. He's not rigorous in his general usage of the terms "feature" and "sugar", but then provides distinctions without definitions.

But who am I to judge the content of a verbose post (the best kind in my opinion) that clearly attempts to explain features of the upcoming C# in a meaningful and useful way. And I want to be clear here that I'm not trying to be a gossip or throw rocks or incite a riot, etc. by commenting here. I tend to agree with your usage of "derogatory".

Thanks for the link.

Paul Bartlett Thursday, September 22, 2005
I've always taken "syntactic sugar" to refer to alternative ways of doing things that are already possible in the same language, whereas the language vs. opcodes example you give clearly refer to two different ones. Likewise, if the new v3.0 syntax enabled something could not be done in pure C# before and only in CIL, that to me would be a compiler feature rather than syntactic sugar.

I haven't checked whether Ted has been consistent in distinguishing between the two, nor am I going to as I'm just happy to have read such an interesting and informative post.
scott Thursday, September 22, 2005
I wasn't nitpicking at Ted's post.

My post was two different thoughts:

1) Ted's article is good.

2) Is syntax sugar really a "bad thing"? It's often stated in a way to trivialize a feature.

I understand in Ted's case he'd like to see more sugar in Java - so sugar must have some value.
Comments are closed.