Hacker News new | ask | show | jobs
by camus2 3049 days ago
> It's everything C can do, but much better.

No, go has a garbage collector. It is not a replacement for C. Languages like C++, Rust or Ada are.

2 comments

Like I said: Go does everything C does, but better.

I suppose you could write your own malloc in Go... if you preallocated a bunch of bytes in a huge chunk, and wrote some functions to use that up. But that sounds like a pain.

If you really really specifically need to manage your own memory, then I agree, you shouldn't use Go. But that doesn't mean that Go is not a valid replacement for C. Do you think a majority of programs that are written in C are done so because they need to manage their own memory?

> Like I said: Go does everything C does, but better.

It doesn't do everything C does, it doesn't allow manual memory management at first place.

So you can't pretend that a garbage collected language does everything a language with manual memory management does.

Manual memory management is a feature, Go does not have such a feature. Deterministic behavior in a program is fundamental when writing hardware drivers or real time programming, Go can't do that.

while it is not fully manual memory management, you can use sync.Pool and it gives you better performance as you can reduce garbage generation.
What does deterministic behavior has to do with "better performance" ?
As already proven by many attempts to implement safe OS, a GC is not an impediment in a systems language, religion and disbelief against GC are.

Joe Duffy has putted it quite nicely regarding how many in the Windows team saw Midori, even though it was proven to be running right in front of their eyes.

RustConf 2017 - Closing Keynote: Safe Systems Software and the Future of Computing by Joe Duffy

-- https://www.youtube.com/watch?v=EVm938gMWl0

> a GC is not an impediment in a systems language,

You'd have to define what you mean by system language at first place before making such a claim.

A programming language capable of building the whole stack from the boot loader, usually written in Assembly, drivers, all the way up to user space applications.

The only programming language for a single platform, besides a little Assembly for hardware integration.

The traditional CS definition of systems programming languages on OS research literature.