News for hackers. Stuff that matters.
Re:Modern garbage collection by wangchow on Tuesday December 20, 2016 @11:02AM (#13220991)
Alas, having no garbage collector at all is a blissful state of simplicity when performance matters. It's not very difficult to clean up one's objects manually in a well-thought-out codebase.
Re:Modern garbage collection by tomp on Tuesday December 20, 2016 @12:33PM (#13221938)
Experience (i.e. the number of memory-related bugs) suggests otherwise.
Re:Modern garbage collection by wangchow on Tuesday December 20, 2016 @12:45PM (#13222064)
What about smart pointers? It gives the flexibility and benefits of garbage-collection without the performance degradation. It's not a silver bullet but it helps.

What I'm getting at is, Rust is the only modern language (in vogue at the moment) that does not use garbage collection. It would be nice if more languages didn't require a garbage collector but gave the option to use one.

If there are some more of such languages please chime in and provide a link to them! :)

Re:Modern garbage collection by tomp on Tuesday December 20, 2016 @01:57PM (#13222778)
> flexibility and benefits of garbage-collection

Not really, as it doesn't allow/collect cycles.

> without the performance degradation

Only for single-threaded code.

I agree with the rest of your comment!

Re:Modern garbage collection by prodigal_erik on Tuesday December 20, 2016 @04:20PM (#13224129)
A smart pointer is just a way to add custom behavior when it's created and destroyed. The question is what the smart pointer does. Usually the answer is update a reference count, which happens so frequently that it ends up being a lot more expensive (especially in bus bandwidth) than occasionally tracing live objects between long periods of useful work.
Re:Modern garbage collection by mike_hearn on Tuesday December 20, 2016 @04:00PM (#13223916)
D has optional GC. However in hindsight it is perhaps not so smart. The problem is that it fractures the ecosystem: some libraries require GC and others don't. If you don't want to use it you have to rely only on non-GC libraries.
Re:Modern garbage collection by user5994461 on Tuesday December 20, 2016 @06:30PM (#13225367)
Smart pointers are as hard to manage as pointers.

There are different kind of smart pointers and you gotta think what you want to do with them. A GC is easier.

Re:Modern garbage collection by wangchow on Wednesday December 21, 2016 @01:00PM (#13231134)
GC is certainly easier. However, it is important to understand the life-cycle of objects regardless. To be able to control them (if desired) is good because in many cases one would prefer to have that control instead of being forced to use garbage collector.

In an ideal world, garbage collector makes sense because we don't want to have to worry about life-cycle management when we are solving other problems. Memory management can indeed be an annoying implementation detail, but as it stands there are certainly limiting factors in hardware which are impacted by generic object-management for specific application domains.

Re:Modern garbage collection by topspin on Wednesday December 21, 2016 @03:25AM (#13227619)
GC isn't the the only way to achieve memory safety.
Re:Modern garbage collection by pjmlp on Tuesday December 20, 2016 @12:29PM (#13221888)
> well-thought-out codebase.

Which in real life means a single developer ownership codebase.

Re:Modern garbage collection by hood_syntax on Tuesday December 20, 2016 @12:45PM (#13222067)
Or a meticulous team of very high quality engineers with top notch documentation and design practices. Note that I do agree with you, however, because as you said:

> in real life

Re:Modern garbage collection by pjmlp on Tuesday December 20, 2016 @01:14PM (#13222374)
In real life most companies don't want to pay for "meticulous team of very high quality engineers with top notch documentation and design practices".

They rather pay for outsourced consultants that deliver something that works within a fixed price contract.

Re:Modern garbage collection by prodigal_erik on Tuesday December 20, 2016 @03:21PM (#13223566)
Knuth's code has bugs. NASA's code has bugs. There's no reason to believe that high quality software engineers even exist.
Re:Modern garbage collection by gpderetta on Tuesday December 20, 2016 @06:31PM (#13225371)
High Quality != 0 bugs.

(Small) teams of high quality engineers do exist, but are very expensive.

Re:Modern garbage collection by wangchow on Tuesday December 20, 2016 @01:36PM (#13222579)
And most humans are lazy f%$#s who throw things away rather than recycling them.
Re:Modern garbage collection by gnaritas on Tuesday December 20, 2016 @02:38PM (#13223202)
> It's not very difficult to clean up one's objects manually in a well-thought-out codebase.

Given the rarity of a well thought out codebase, I'd say it is. As soon as multiple people work on something confusion always ensues.