<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 1 February 2014 19:27, Adam Wilson <span dir="ltr"><<a href="mailto:flyboynw@gmail.com" target="_blank">flyboynw@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Fri, 31 Jan 2014 23:35:44 -0800, Manu <<a href="mailto:turkeyman@gmail.com" target="_blank">turkeyman@gmail.com</a>> wrote:<br>
<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
On 1 February 2014 16:26, Adam Wilson <<a href="mailto:flyboynw@gmail.com" target="_blank">flyboynw@gmail.com</a>> wrote:<br>
<br>
</div><div><div class="h5"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Fri, 31 Jan 2014 21:29:04 -0800, Manu <<a href="mailto:turkeyman@gmail.com" target="_blank">turkeyman@gmail.com</a>> wrote:<br>
<br>
 On 26 December 2012 00:48, Sven Over <<a href="mailto:dlang@svenover.de" target="_blank">dlang@svenover.de</a>> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
  std.typecons.RefCounted!T<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
core.memory.GC.disable();<br>
<br>
<br>
</blockquote>
Wow. That was easy.<br>
<br>
I see, D's claim of being a multi-paradigm language is not false.<br>
<br>
</blockquote>
<br>
<br>
It's not a realistic suggestion. Everything you want to link uses the GC,<br>
and the language its self also uses the GC. Unless you write software in<br>
complete isolation and forego many valuable features, it's not a solution.<br>
<br>
<br>
 Phobos does rely on the GC to some extent. Most algorithms and ranges do<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
not though.<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
</blockquote>
Running (library) code that was written with GC in mind and turning GC<br>
off<br>
doesn't sound ideal.<br>
<br>
But maybe this allows me to familiarise myself more with D. Who knows,<br>
maybe I can learn to stop worrying and love garbage collection.<br>
<br>
Thanks for your help!<br>
<br>
<br>
</blockquote>
I've been trying to learn to love the GC for as long as I've been around<br>
here. I really wanted to break that mental barrier, but it hasn't<br>
happened.<br>
In fact, I am more than ever convinced that the GC won't do. My current #1<br>
wishlist item for D is the ability to use a reference counted collector in<br>
place of the built-in GC.<br>
You're not alone :)<br>
<br>
I write realtime and memory-constrained software (console games), and for<br>
me, I think the biggest issue that can never be solved is the<br>
non-deterministic nature of the collect cycles, and the unknowable memory<br>
footprint of the application. You can't make any guarantees or predictions<br>
about the GC, which is fundamentally incompatible with realtime software.<br>
Language-level ARC would probably do quite nicely for the miscellaneous<br>
allocations. Obviously, bulk allocations are still usually best handled in<br>
a context sensitive manner; ie, regions/pools/freelists/<u></u>whatever, but the<br>
convenience of the GC paradigm does offer some interesting and massively<br>
time-saving features to D.<br>
Everyone will always refer you to RefCounted, which mangles your types and<br>
pollutes your code, but aside from that, for ARC to be useful, it needs to<br>
be supported at the language-level, such that the language/optimiser is<br>
able to optimise out redundant incref/decref calls, and also that it is<br>
compatible with immutable (you can't manage a refcount if the object is<br>
immutable).<br>
<br>
</blockquote>
<br>
The problem isn't GC's per se. But D's horribly naive implementation,<br>
games are written on GC languages now all the time (Unity/.NET). And let's<br>
be honest, games are kind of a speciality, games do things most programs<br>
will never do.<br>
<br>
You might want to read the GC Handbook. GC's aren't bad, but most, like<br>
the D GC, are just to simplistic for common usage today.<br>
</blockquote>
<br>
<br></div></div><div class="im">
Maybe a sufficiently advanced GC could address the performance<br>
non-determinism to an acceptable level, but you're still left with the<br>
memory non-determinism, and the conundrum that when your heap approaches<br>
full (which is _always_ on a games console), the GC has to work harder and<br>
harder, and more often to try and keep the tiny little bit of overhead<br>
available.<br>
A GC heap by nature expects you to have lots of memory, and also lots of<br>
FREE memory.<br>
<br>
No serious console game I'm aware of has ever been written in a language<br>
with a GC. Casual games, or games that don't attempt to raise the bar may<br>
get away with it, but that's not the industry I work in.<br>
</div></blockquote>
<br>
That's kind of my point. You're asking for massive changes throughout the entire compiler to support what is becoming more of an edge case, not less of one. For the vast majority of use cases, a GC is the right call and D has to cater to the majority if it wants to gain any significant mindshare at all. You don't grow by increasing specialization...</blockquote>
<div><br></div><div>Why is ARC any worse than GC? Why is it even a compromise at the high level?</div><div>Major players have been moving away from GC to ARC in recent years. It's still a perfectly valid method of garbage collection, and it has the advantage that it's intrinsically real-time compatible.</div>
<div><br></div><div>I don't think realtime software is becoming an edge case by any means, maybe 'extreme' realtime is, but that doesn't change the fact that the GC still causes problems for all realtime software.</div>
<div><br></div><div>I personally believe latency and stuttering is one of the biggest usability hindrances in modern computing, and it will become a specific design focus in software of the future. People are becoming less and less tolerant of latency in all forms; just consider the success of iPhone compared to competition, almost entirely attributable to the silky smooth UI experience. It may also be a telling move that Apple switched to ARC around the same time, but I don't know the details.</div>
<div><br></div><div>I also firmly believe that if D - a native compiled language familiar to virtually all low-level programmers - doesn't have any ambition to service the embedded space in the future, what will? And why not?</div>
<div>The GC is the only thing inhibiting D from being a successful match in that context. ARC is far more appropriate, and will see it enter a lot more fields.</div><div>What's the loss?</div><div><br></div><div>I think it's also telling that newcomers constantly raise it as a massive concern, or even a deal-breaker. Would they feel the same about ARC? I seriously doubt it. I wonder if a poll is in order...</div>
<div>Conversely, would any of the new-comers who are pro-GC feel any less happy if it were ARC instead? $100 says they probably wouldn't even know, and almost certainly wouldn't care.</div></div></div></div>