On Monday, 6 June 2016 at 20:28:47 UTC, poliklosio wrote:
On Monday, 6 June 2016 at 15:06:49 UTC, Carl Vogel wrote:
(...) Also, the idea that more people will adopt D if you just
"get rid of the GC" ignores the fact that you don't just "get
rid of the GC," you replace it with another memory management
scheme (manual, RAII, RC). If you replace all the parts of the
language and phobos that rely on GC with, e.g., a poor
implementation of RC, then you're just going to get another
round of complaints, and no real adoption.
I think you are going to get some adoption it you replace good
GC with clunky RC.
The key difference is a call to a function that uses GC is
incomplete: some of it will execute later, after the call has
finished.
On the other hand a call to an equivalent function that uses RC
has only local (in time) consequences: once you finished the
call, it stopped executing. If it returned something that needs
to be freed later, you know what it is.
Of course people can write arbitrarily messed up things like
singletons etc. but I'm not counting those because good
libraries are usually free of those.
This means you have control over all the OTHER code, however
inefficient the call is.
Hence, the second is acceptable in low-latency code, but the
first is not.
I get that and agree. My point was a different one -- that these
conversations are about a totally hypothetical RC implementation
that we all imagine is perfect, and so we just discuss
theoretical GC vs RC tradeoffs. The real one that gets made is
going to have bugs and unexpected corner cases. So the risk is
that at some point we'll all run to reddit and say "Tada, no more
GC" and folks will then just say "D has RC, but it's buggy and
unreliable and doesn't work when [insert anecdote]"
Maybe that won't be so---maybe the new memory management regime
will be perfect and elegant and have no nasty surprises. But I
feel a real "grass is greener" sense, when as many other has
pointed out, the current GC could use a lot of love, which would
solve problems for a lot of current users.