D vs Go on reddit

so so at so.do
Thu Feb 3 10:58:55 PST 2011


> Jokes aside, I think people in language-debates often forget that
> high-level languages are really just layers of syntactical sugar over
> machine-code. ASM is syntactical sugar over machince-code, C is
> syntactical sugar over ASM, and D is mostly syntactic sugar over C.
> They are merely ways to streamline certain programming-models, into a
> language that encourages those idioms and constructs. Just about
> anything that can be written in D, can be written with equivalent
> semantics in C, but the D-version is likely to be faster to write, and
> faster to comprehend.
>
> The purpose of higher-level languages is to encourage "good"
> programming style and readability. Period. The syntax is crucial here,
> it determines which constructs will become readable, and which won't,
> which in turn determines the mind-set of the programmer. Which is why
> I consider syntactic sugar to be seriously under-appreciated and
> undervalued in many language decisions.

One argument i often encounter about features, syntax in language  
discussions is "What namespaces can do that namespace_func can't?".
Answer might be pretty obvious to many, but consider the corner cases of  
some namespace implementations. (C++ here)

You simply can't provide a clean library with the given namespace features.

---
namespace ns1 {
	class A;
	....
}

namespace ns2 {
	
	class C {
		A* pa;
	};
}
---

but in D it is quite elegant.

---
module ns2;
private import ns1;

class C {
	A* pa;
};
---


More information about the Digitalmars-d mailing list