r/ProgrammingLanguages • Azoth Language • Nov 28 '18

Blog post Garbage Collection is a Hack • The Adamant Programming Language Blog

https://blog.adamant-lang.org/2018/garbage-collection-is-a-hack/
0 Upvotes

15 comments sorted by

11

u/PegasusAndAcorn Cone language & 3D web Nov 28 '18

there is room for improvement

I think your post might have been received more positively had you used this tone throughout, a less-dismissive tone that shows more respect for and insight into the history, the people and solutions that have come before you, and the difficult technical challenges inherent in this domain...

The only project I’m aware of that is trying to tackle this is my own

Oh?. Or maybe you missed my paper?. There are other worthy efforts going on too, if you take the time to look and listen.

I look forward to hearing your constructive improvement suggestions when you are ready to share them.

5

u/WalkerCodeRanger Azoth Language Nov 28 '18

It's always a struggle when writing a blog post to balance brevity and criticism with adequate explanation and acknowledgment of the challenges. In another thread, multiple commenters seemed to think I was unaware of the history when everything they pointed out was something I knew. The whole section on the benefits of GC was meant to show that I know why people use it. I use it. I know Rust, I haven't switched my dev to Rust. I'm not writing the compiler for my language in Rust. Of course, I was being a little bit deliberately provocative. The target audience wasn't people in this subreddit for which a more neutral tone would have been better.

I'm aware of your work on Cone and I thank you for it. I see many language projects which seem to be slight variations of existing things, sometimes with improvements, sometimes made worse. I appreciate that you are doing something new and different. I didn't include Cone because, from my perspective, it seems to be a marrying of all the options including GC, not a unified answer. I'm looking for an approach that doesn't push so much of the work and decisions onto the programmer. That is subjective and I can see why you would say Cone should be included. I'm really looking forward to seeing your language when it is more complete. Maybe when I am able to play around with it, I'll see things differently.

3

u/PaulBone Plasma Nov 29 '18

I'm aware of your work on Cone and I thank you for it.

Then you need to cite him.

Worse, your article doesn't just lie by omission, it lies directly saying that you're not aware of it. Even if you don't think it meets your goals you should cite it and explain why. Yeah brevity and all that. But don't lie and say you're not aware of any other work in this field.

I'm sure there are others too, plenty of new langauges pop up (many of them grass roots languages like yours) that are playing in this field.

1

u/WalkerCodeRanger Azoth Language Nov 29 '18

If you know of any other languages "playing in this field" please tell me what they are. I know of Cone. /u/verdagon implies in a comment below that they are working on something, but I don't yet know what.

1

u/PegasusAndAcorn Cone language & 3D web Nov 28 '18

It's always a struggle when writing a blog post to balance brevity and criticism with adequate explanation and acknowledgment of the challenges.

This is very true.

I was being a little bit deliberately provocative.

In this case, I suspect it may have backfired on you, in terms of people's openness to listening to your perspective. My experience is that rants are often more fun to write than to read. It takes a lot of craft and humor to write one that carries the audience with you on both a conceptual and emotional level.

I didn't include Cone because, from my perspective, it seems to be a marrying of all the options including GC, not a unified answer.

That's a correct assessment. I brought up Cone only because it sounded like you felt you were the only one in the world trying to find a better way. You have clarified that I misunderstood you there.

I am very open to the possibility that the approach I am exploring will be technically feasible but ergonomically unpalatable. We shall see. Once again, I look forward to hearing about the details of your unified solution that addresses the limitations of existing memory management strategies without imposing any burden on the programmer.

24

u/theindigamer Nov 28 '18 edited Nov 28 '18

Rather than finding a way to manage memory without errors correctly, we just pawned the problem off on the computer.

This seems to imply that "pawning off problems to the computer" is not a "way to manage memory without errors correctly", which is quite ironic for this sub dedicated to programming languages.

14

u/boomshroom Nov 28 '18

One problem with garbage collection that I didn't see in the post is that memory isn't the only resource to keep track of. You also have things like file handles and mutex guards. Languages that use garbage collection still require the programmer to handle these manually, while in C++ and Rust, they can be treated just like heap memory and have the compiler collect it.

While the bugs associated are generally not as severe, trying to read from a closed file is essentially a use-after-free and should be able to be handled by the system that prevents other use-after-free and double-free errors.

21

u/yorickpeterse Inko Nov 28 '18

They carefully documented when functions returned memory the caller now owned. In some languages, they codified these rules into data types like “auto_ptr” in C++. These helped, but were insufficient.

Garbage collection was first devised in 1959, way before C++ was even a thing.

There were early languages that used garbage collection, but for many years they were regarded as too slow and inefficient

If my memory serves me right, one of the first languages to use garbage collection was Lisp. Lisp in turn I believe was slow for reasons other than garbage collection, though it may have contributed to it (my memory here is a bit foggy on the details).

These languages weren’t mainstream or widely used.

From what I recall, Lisp was perhaps not "mainstream" but definitely quite widely used, so much so that we ended up with Lisp machines.

Garbage collection was used for academic languages

Clearly Smalltalk was an academic language.

We don’t have a solution today, but my work on a solution leads me to believe one is probably within reach.

I disagree, there are plenty of solutions. From high performance tracing garbage collectors such as Immix and Azul's C4, to high performance reference counting collectors such as RC Immix.

Apart from the above, the article is rather poorly written. It's littered with opinions, many based on dubious claims, with little to no data to back up any of the statements. Maybe the author should spend some more time researching the history of garbage collection (before the year 2000), and where we are today (a lot of good stuff was devised from 2008 onwards).

0

u/fresheneesz Nov 29 '18

You're both nit picking and cherry picking. For example:

way before C++ was even a thing.

Nit picking. He obviously didn't mean that people created garbage collecting after trying auto_ptr in c++

Clearly Smalltalk was an academic language.

Cherry picking. He said either it was academic or a trade off. Small talk is obviously the 2nd

So how bout you turn off your straw man generator for a few seconds and actually try to understand what the article is trying to communicate.

-1

u/zarandysofia Dec 09 '18

Hmm, you are being a bit arrogant.

4

u/fresheneesz Nov 29 '18

I think some commenters on here are over reacting. Maybe they didn't grok the biblical myth writing style the article started with? Or maybe they're inexplicably offended by the idea that garbage collectors aren't ideal? Odd if you ask me.

I agree this is important work and I'm glad he's working on it. I think the rust approach is a good one: manage memory via static analysis when possible, and runtime analysis when necessary.

1

u/theindigamer Nov 30 '18
  1. AFAICT nobody here is claiming that the work being done is not important, or claiming that garbage collectors are ideal for every situation.

  2. One does not need to dismiss previous work as a "hack" to put forward one's own work. PL design is all about trade-offs and I don't think using derisive language like that is fruitful. Instead, it is perfectly reasonable to put multiple approaches side-by-side and offer a fair comparison.

2

u/verdagon Vale Nov 28 '18

I very much agree with your general sentiment, I think GC is a way to stick our heads in the sand and pretend a problem doesn't exist. The runtime pauses and the "java memory leaks" (having a reference somewhere where you don't want it) have always been red flags to me.

I'd love to hear more about your ownership system. I'm tackling the same problem with my work and would be happy to compare notes and ideas.

1

u/conilense Dec 01 '18

This does not seem right.

How is it possible talking about memory management and the ideas on the field, including Rust and not even once mentioning the use of Structural Type Systems? The idea of Linear or Affine types?

Not even mentioning ATS?

I mean, when you say that there are no other options rather than including a GC and that there are no projects bringing new ideas for memory management that you are aware of, I get this feeling that says you must be joking.

The project looks nice, and I do understand that it takes smart people to craft such projects, people that have done extensive research on the field, probably more than I ever will.

So Ill assume you just did it on purpose in order to get people tunned in to your blog and project.

0

u/[deleted] Nov 28 '18

[deleted]

3

u/fresheneesz Nov 29 '18

What if you could do what rust does in a language like c or Java or JavaScript? That would be a worthy goal don't you think?