Fulfilling a Pikedream: the ups of downs of porting 50k lines of C++ to Go

Well,

D has sufficiently powerful templates, but you cannot really use it well without GC. It is also just another of those “classes should be allocated on the heap”-languages which is mainly good for destroying cache-friendly memory-access. I mean, lack of GC really is not a problem in C++; like: At all. I have yet to come across a problem where it would really be an advantage for me.

So: D is not a C++-replacement.

Considering Nim: I don't know too much about that language-but IIRC more or less the same problems as with D apply.

Rust is more interesting: AFAIK it is the first time that someone tried to design a language and understood what C++ was about and what were it's advantages and problems. So there probably isn't some kind of fundamental design-flaw that basically kills the language before you even need to look at it.

However, there are problems: Rust definitely has less powerful templates than C++. The fact that their printf-like functions are not functions but macros speaks volumes (In C++ it has been possible for quite a while to write such functionality completely typesafe for an arbitrary number of arguments and I guess that at some point we will get something like it in the standard because nobody really likes std::printf and std::cout). In General: Every time they need variadic functions they reach for macros. IMHO this clearly shows that their generics aren't powerful enough.

Then there are design-quirks that could have been avoidable like shadowing within a scope (let foo = 3; let foo = "bar";). They are not lethal to the language but if I want sharp edges, the ones in C++ are at least well known.

Then there is this thing with two string-types and no implicit conversion between them even though it would be completely safe in both directions.

Finally, IIRC the syntax for using a generic type in rust is GenericType::<T> which adds another two characters line-noise to actually quite fine to read C++-version generic_type<T>. I understand that this is to simplify the grammar and make parsing easier, but I'd like to point out the old saying that code should be written for humans, not computers.

So: Rust is an interesting idea but you definitely loose there too in some areas.

/r/programming Thread Link - togototo.wordpress.com