Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Idk why people are so worried about gc in general, just keep an object pool around and byte arrays if strings are immutable and never see a GC pause. Sure it'll look a lot like c, but that's besides the point.


At that point, you're not benefiting from the GC'ed language. Just use C/C++/Rust/etc, and you'll end up with something faster and more reliable for a small fraction of the effort.


Most modern GC-ed languages offer more than just garbage-collector: On top of my head:

1. Prevents memory corruption

2. Have way better compilation time than C++ and Rust, absolutely horrid compile time for both.

3. Have all sorts of developer-ergonomics features (like being able to write functions in arbitrary order (compared to C/C++))

4. Have built in reflection (none in C/C++)

5. IDEs/autocomplete/refactoring tools etc, just generally work better for C#/Java/etc.

Garbage collection is probably close to bottom on the list why I would use GCed language when making an indie or hobby scale game

I would never consider using Rust simply because it takes too long time to compile even for relatively small projects.

Especially not for hobby or indie scale game projects.


Why downgrade my developer experience, when my GC language also offers C++ class features if I really need them.

People should learn more about what is in the toolbox.


Different languages are not downgrades/upgrades - they're different balance points between constraints.

Also, classes are merely one feature of C++. The language is a far cry from 40 years ago, when it was "C with classes".


Agree, however a large majority uses C++ as what I call C+, which is basicaly "C with classes" with a bit of C++11.

To the point that we have the Orthodox C++ movement, and educating people to move beyond "C with classes" that keeps being taught around the world is a common discussion subject at C++ conferences, and ISO C++ papers.


I would certainly have agreed with this characterization of the majority 10 years ago. But - do you really believe this is still the case today? After 10 years of C++11 making headway, and a lot of effort to educate people differently? I wonder...


Object pools don’t turn off by one errors into complete remote code execution exploits.


How does a GC help with that? That's just boundary checking.


Just? :)

And don’t forget about all the other ways such corruption could happen, use after free etc.

On top of all that, in managed languages you generally have a stronger runtime type information on top, that doesn’t accept arbitrary memory address to implicitly be read as executable code. Even explicit static casts from Object to more defined type will fail if the object is not of expected type. Code must be defined as function objects in the language to begin with.


Object pooling without GC has the same use-after-free problem as with it.


Coding imperfectly in safe languages leads to performance issues. Coding imperfectly in unsafe languages leads to correctness issues.

It’s a trade-off; performance in games is more important than correctness anyways so I tend to agree with you here.


A nitpick: correctness and type safety are very different concepts. Type-safe languages don't provide correctness (and vice versa).


They didn’t mention type safety though (Unless they’ve edited their post?)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: