3 ms·
Sugar obviously does not require some automatic language translation. It just means that in all cases a human can rewrite it without the new syntax and get the
by akvadrako 8y ago
Sugar obviously does not require some automatic language translation. It just means that in all cases a human can rewrite it without the new syntax and get the same semantics.
Unless you can provide an example where that isn't true, it's just sugar, i.e. unneeded, but maybe desired, syntax.
- chriswarbo 8y ago> Sugar obviously does not require some automatic language translation What makes you say that? I would say it's crucial. Syntactic sugar is anything where we can say "Code of the form 'foo x y z...' is defined as 'bar x y z...'" where both forms are valid in the same language. Such a definition, by its very nature, gives us an automatic translation (look for anything of the first form, replace it with the second). > It just means that in all cases a human can rewrite it without the new syntax and get the same semantics. Yet that's so general as to be worthless. I'm a human and I've rewritten Java programs in PHP, but that doesn't make Java "syntactic sugar" for PHP.