Why are so many languages forced-GC?

Seriously, can no one comprehend any other way to manage memory? Do the bad aspects of C's way of managing memory scare people away from C++'s way of managing memory?

Garbage collection is fine when it is used in the correct scenarios. But it seems that a huge number of languages force it onto programmers with no other choice, even when a large number of use cases don't benefit from GC.

Are there no other languages where scope-based object lifetime is the norm? Seriously, I just want a modern language where by default the destructor is called when the variable tied to the object goes out of scope.

Ideally, I'd want a language where all memory, dynamic or not, was bound to a scope, but could be transferred to a different scope. Apparently that makes people's heads explode, though.
You should look closer at Rust.

Doing a full-fledged but optional GC is very hard. Basically that would mean two separate heaps, one GCed, the other one manually managed and restricting objects pointing from one heap to the other and vice versa.
closed account (3hM2Nwbp)
Doesn't C++/CLI do this? If I recall the "managed" pointers (syntax: type^ identifier) are allocated in a different manner than normal pointers and is subject to GC or an equivalent system.
Last edited on
closed account (z05DSL3A)
"Automatic Reference Counting (ARC) is a compiler feature that provides automatic memory management of Objective-C objects. Rather than having to think about retain and release operations, ARC allows you to concentrate on the interesting code, the object graphs, and the relationships between objects in your application."
Rust: I've read some bad news about the destructors, but at least it has destructors. @rapidcoder I hadn't considered that you'd need both at the same time to use external libraries :(

C++/CLI: I don't think this is portable in the same way that C++/Java/Python/etc are portable.

Objective-C: Interesting - how portable is Objective-C? My friends hate the syntax but I'm willing to be open-minded.
Objective-C: Interesting - how portable is Objective-C?
not very unfortunately, because its one of the few things i like about apple. the obj-c compiler is closed source and only built for apple machines. there is a gcc framework called gnustep, which is supposed to work a lot like obj-c, but im not sure how reliable it is or if its *nix only or cross platform
closed account (z05DSL3A)
Check gcc or clang, you should have objective-c. The language itself should be fine on multiple platforms, Cocoa and nextStep would be the problem you could look at gnustep and Cocotron.
Topic archived. No new replies allowed.