8 ms·
Please don't get me wrong, as I don't want to start a flame here, but why do they call D a "systems programming language" when it uses a GC? Or is it optional?
by brakmic 10y ago
Please don't get me wrong, as I don't want to start a flame here, but why do they call D a "systems programming language" when it uses a GC? Or is it optional? I'm just reading through the docs. They do have a command line option to disable the GC but anyway...this GC thing is, imho, a no-go when it comes to systems programming. It reminds me of Go that started as a "systems programming language" too but later switched to a more realistic "networking stack".
Regards,
- bachmeier 10y agoThe GC is only relevant if you allocate using the GC, because that is the only time the GC can run. If you use @nogc on your functions, you are guaranteed not to have GC allocations. You can use D as a better C with no GC but other good features. You can even avoid the D runtime compeletely if you want.
- brakmic 10y agoThanks for your helpful answer. ...and I don't understand why some people have downvoted my question. Anyway, I'll continue reading the docs :)
- bachmeier 10y agoI don't understand the downvotes either. Anyway, the docs are not that great, so Mike Parker has started a blog post series about the GC.[1] If you have questions, drop them in the d.learn forum.[2] They're pretty friendly (most of the time). [1] http://dlang.org/blog/2017/03/20/dont-fear-the-reaper/ http://dlang.org/blog/2017/03/20/dont-fear-the-reaper/ [2] https://forum.dlang.org/group/learn https://forum.dlang.org/group/learn
- mixmastamyk 10y agoDidn't downvote, but found "Please don't get me wrong, as I don't want to start a flame here, but…" redundant and slightly annoying. ;)
- asimpletune 10y agoWhy does gc disqualify a language as a system's language? P.S. I think of a system's language as one that runs directly on the machine, e.g. Swift, C, go. They operate at the "system" level.
- Rusky 10y agoYou can definitely do systems programming with a GC, but it does get in the way sometimes. Drivers will most likely need to bypass it entirely; more importantly, libraries to be embedded in other programs (including scripting languages) now have to deal with two garbage collectors rather than one.
- camus2 10y ago> Why does gc disqualify a language as a system's language? AFAIK a "system programming language" should have deterministic performances, obviously Go hasn't. But different people might define "systems" differently.
- vardump 10y agoI think Go should be pretty deterministic, if you don't allocate or free at all at runtime. Just like C. You lose determinism with malloc() and free(). As any embedded/kernel developer knows, malloc() takes often unacceptably long time. Or even free().
- sqeaky 10y agoGo does allocate and free at runtime, it just isn't explicit because its a garbage collected language and the garbage collector handles most of the freeing for you. Different GC'd languages handle allocations differently, some have a keyword, some do it whenever creating an instance of a type over a certain size. With C, C++ and Rust allocating memory often boils down to calling something equivalent to malloc and free. While the cost is not precisely known all modern OS provide guarantees are the time to execute relative to the size of the amount requested. This is almost always such a simple and fast operation that allocation is what gets optimized only after the algorithms and data structures have been tuned and this is a known bottleneck. Many application never get to the stage of optimizations (Games almost always do, stupid fixed time frame budget). Consider the amount of work the GC does and understand why any GC is generally considered no-deterministic: https://blog.golang.org/go15gc https://blog.golang.org/go15gc
- mhh__ 10y agoD's garbage collector is both written in D and entirely optional, that alone should qualify it as a systems language. The gc can be disabled with @nogc, the command line flags are only if you want to disable it for the whole program or if you want warnings as to where the allocations happen. https://godbolt.org/g/IQ0O06 https://godbolt.org/g/IQ0O06
- klickverbot 10y ago> https://godbolt.org/g/IQ0O06 https://godbolt.org/g/IQ0O06 (And, of course, the entire main() disappears on -O1 and above: https://godbolt.org/g/FAWtak. https://godbolt.org/g/FAWtak.)
- deleted 10y ago[deleted]
- pjmlp 10y agoSystems programming languages with GC exist since the late 60's, with ALGOL 68RS being one of the first ones. Since then a few remarkable ones were Mesa/Cedar, Modula-2+, Modula-3, Oberon(-2), Active Oberon, Sing#, System C#. The reasons why so far most of them didn't won the hearts of the industry weren't not only technical, but also political. For example Modula-3 research died the moment Compaq bought DEC research labs, or more recently System C# died when MSR disbanded the Midori research group. If you want to learn how a full workstation OS can be written in a GC enabled systems programming language, check the Project Oberon book. Here is the revised 2013 version, the original one being from 1992. https://people.inf.ethz.ch/wirth/ProjectOberon/index.html https://people.inf.ethz.ch/wirth/ProjectOberon/index.html