4 ms·
skip D, try Go-lang
by freakinjoe 15y ago
skip D, try Go-lang
- Peaker 15y agoI don't like D, but Go-lang is no substitute for C or C++: It's a GC'd language.
- starwed 15y agoI know effectively nothing about D, but one of the repeated answers was that D effectively requires you to use its GC. (With the qualifier that while technically, you don't have to use GC, doing otherwise will cause pain.)
- sambeau 15y agoYou can switch the GC off in D you can't in Go. I however wouldn't advise it - GC has a valid reason to be the essential it is considered to be today.
- sambeau 15y agoUnless you are doing realtime embedded programming there is absolutely no reason why Go isn't a good substitute for C & C++. Having worked in a large games company writing realtime performance-heavy code in C# I know that GC isn't the barrier you think it is - in fact quite the opposite: most of the time it makes things faster, cleaner and safer. Having a GC can give you more control over how your garbage is freed – it helps you put it off until you have time to do it (without writing your own complex garbage collection routines like many C++ programmers do). In the rare places you need a malloc/free you can easily write your own and manage your own memory pools.
- Peaker 15y agoI use C for very-soft real-time, and have very little memory management code in practice. I think you're misrepresenting the situation about control. With C, you can (and indeed sometimes do) manage a list of things to "free later". You have full control over when to free things. I use GC'd languages too, plentifully, and agree that GC beats a lot of the average manual memory managed code. People using C write a lot of unnecessary mallocs/frees. But I don't think GC would work well for the kind of code I work on. If I wanted a high-performance GC'd language, why would I use Go and not Haskell?
- sambeau 15y agoFair point about Haskell. Horses for courses. I love the simplicity of Go. Haskell's simplicity breaks for me around the point that I have to use a Monad: brain splosions.
- Peaker 15y agoA Monad is pretty simple. class Monad m where return :: a -> m a (>>=) :: m a -> (a -> m b) -> m b and the left-neutral/right-neutral/associativity laws: x >>= return = x return x >>= f = f x x >>= (\v -> y v >>= z) = (x >>= \v -> y v) >>= z Last law can be expressed more easily if you define: (f >=> g) x = f x >>= g Then you can say: (f >=> g) >=> h = f >=> (g >=> h) How complex is that?
- deleted 15y ago[deleted]