vibe.d / experience / feedback

Ola Fosheim Grøstad ola.fosheim.grostad at
Mon Oct 12 19:58:12 UTC 2020

On Monday, 12 October 2020 at 11:06:55 UTC, Robert M. Münch wrote:
> Go seems to be kept as simple as possible, even if you have to 
> write more code. Which is, in the long run, the cheaper and 
> smaller burden. No tricks, no surprises... that has a lot of 
> merits.

Btw, Go has some major weaknesses related to tricks and surprises:

1. No exceptions... they encourage old 70s-style checking of 
errors everywhere. That makes code much less readable. It is 
possible to roll your own mechanism using their panic() feature, 
but most Go enthusiasts frown upon that. (ignore them, they are 

2. Not as strong typing as it should have. Things related to 
interfaces may not be detected until runtime if you get sloppy 
with it. (avoid very generic interfaces)

3. I believe dynamic arrays are reallocated automatically, like 
in D. So in Go, if you extend a dynamic array it will relocate 
and old slices will peek to the old copy:
	a := make([]int, 3)
	b := a[:]
	a = append(a,4,5,6)
	b[2] = 3;
[0 0 0 4 5 6]
[0 0 3]

So you have to define your own coding standard to avoid such 
issues. Basically, ignore what is touted as Go idioms and create 
a ruleset that makes sense for you.

More information about the Digitalmars-d-learn mailing list