re: Sh*tpost: can we stop saying "syntactic sugar"? VIEW POST


I'm a huge fan of syntactic sugar in C# - but its always there. In JavaScript, support is dependent on the environment unless you transpile and polyfill all of your code all of the time (at least for example the spread operator)

C# example (14 lines to 1 with proper linting):

public string Property { get; set; }

Is syntactic sugar for:

private string propertyField;

public string Property
        return propertyField;

        propertyField = value;

Well I guess coffeescript is complete syntax caramel then!

That is a really clear example, thanks!


lol "complete syntax caramel"... I love it! I'm using that!

I've also used the term "syntactic saccharine" to describe bad sugar. Causes cancer of the semicolon.

I like how CoffeeScript turns this

x?.y?.z = 3

into this

if (typeof x !== "undefined" && x !== null) {
  if ((ref = x.y) != null) {
    ref.z = 3;

Short, sweet, and succinct. Now that is a delicious syntactic caramel!

Those are great. Included with C# 6, probably copied from coffeescript.

code of conduct - report abuse