aldacron | 4 years ago | on: Driving with D
aldacron's comments
aldacron | 4 years ago | on: Driving with D
-betterC is not the only way to avoid the GC in D, just the most extreme. The original motivation for -betterC was to ease porting C code to D. Walter has used it for that to port a good bit of his old C code over. But it's also suited for the space in which the blog author is using it, and some people just prefer it. You always have access to the existing C ecosystem, but there are people writing -betterC libraries in the D ecosystem. And as more people use it, I expect that space will grow.
aldacron | 4 years ago | on: Driving with D
https://dlang.org/blog/2017/07/28/project-highlight-funkwerk...
aldacron | 4 years ago | on: Adding ANSI C11 C compiler to D so it can import and compile C files directly
aldacron | 4 years ago | on: Adding ANSI C11 C compiler to D so it can import and compile C files directly
https://dlang.org/blog/2018/12/04/interview-liran-zvibel-of-...
aldacron | 5 years ago | on: D 2.093.0
aldacron | 5 years ago | on: D 2.093.0
aldacron | 5 years ago | on: Better C – A subset of D Programming Language
When the return type actually matters, auto should be avoided unless there's no way around it. But that's why we have "Returns:" in Ddoc. The function signature itself is not the complete documentation. I mean, you're acting like all D functions are documented to return auto. They aren't. It's used where it needs to be.
aldacron | 5 years ago | on: Better C – A subset of D Programming Language
aldacron | 5 years ago | on: Better C – A subset of D Programming Language
aldacron | 5 years ago | on: Better C – A subset of D Programming Language
aldacron | 5 years ago | on: Better C – A subset of D Programming Language
aldacron | 5 years ago | on: Better C – A subset of D Programming Language
aldacron | 5 years ago | on: DustMite: A General-Purpose Data Reduction Tool
aldacron | 6 years ago | on: Wc in D: 712 Characters Without a Single Branch
The intent isn't to turn off the GC completely (though GC-averse folks assume that it is). The `@nogc` function attribute is intended to be applied where you need it. Then you can guarantee that in that function's call stack, no language features that require the GC will be used.
The standard library has been retrofitted to eliminate use of the GC where it isn't needed and provide alternatives where possible (such as a function that takes a buffer as an argument alongside one that allocates). There may still be places where it can be trimmed down even more, but it will never be fully `@nogc` compatible.
D is meant to be used with the GC, but provides the means to avoid allocations, turn collections on/off (`GC.disable/enable`) and command line options for profiling GC usage and affecting its behavior. Anyone who wants to turn off the GC completely is going beyond the primary intended use case and is of course going to run into bumps with the standard library. Much of it is still usable, though.
aldacron | 6 years ago | on: My Vision of D’s Future
aldacron | 7 years ago | on: DConf 2019 in London
aldacron | 7 years ago | on: DConf 2019 in London
Yes. Walter was referring to the operator itself. Strings are arrays.
> as well as exceptions
It's not exceptions themselves, but the `new` operator. It directly allocates from the GC. That said, there is a plan to enable @nogc exceptions.
> At that point it becomes a valid question why one should learn about the pitfalls of GC free D, when one already knows that about the currently used language.
People who already know another language and are happy with it have no reason to switch. Why would they? It's people who aren't completely satisfied with a given language that are going to be more open to looking at others. And so of course then it's a matter of weighing pros and cons. Do I like the syntax? Does it feel intuitive? Am I comfortable using it? Do I find the pain points blockers or minor annoyances?
There is nothing special about D in this regard. If you aren't looking for a new language, you aren't going to try it. And if you are, you either like it or you don't.
WekaIO wrote the world's fastest filesystem in D. They did it without the GC, and went so far as to write their own GC_free standard library (which they open sourced). Their CEO talked about why in this interview:
https://dlang.org/blog/2018/12/04/interview-liran-zvibel-of-...
That said "GC-free D" is not a major selling point of the language. You will not find the maintainers recommending anyone start a D project fully GC-free unless there is a very specific use case, like that of WekaIO or the blog post author. The allocation patterns in D are different than they are in Java or C#, it's clearly defined when a collection may trigger, the @nogc attribute provides compiler enforcement for avoiding GC allocations in specific functions, a command-line switch can warn you about the same if you find @nogc too much to think about (because employing @nogc does require more consideration of your architecture), and other switches can help minimize the impact of GC.
So the tools are there for anyone who needs them. There are definitely rough edges and we are forever in need of improvement, but everything is usable and people are using D in production right now.