April 04

On Monday, 1 April 2024 at 20:45:25 UTC, Adam Wilson wrote:

>

On Monday, 1 April 2024 at 01:58:51 UTC, Lance Bachmeier wrote:

>

On Sunday, 31 March 2024 at 14:22:43 UTC, Adam wrote:
The first question to ask is "Does it matter one way or the other?" Since you're probably not writing the Linux kernel, even if you're engaged in 'systems programming', the answer is quite often no. If the answer is yes, the second question to ask is "Does it matter enough?"

I dislike these debates because most of those arguing against the GC are insufficiently informed to engage in a worthwhile debate. Many of them don't even understand that you can do things with a programming language other than write video games.

The discourse around the GC has gotten so ridiculous that I have seriously considered asking Walter to declare that "If you want to create an OS or Video Game, consider a different language."

OS/Games is actually a fairly uncommon use of D, if you look at what the people who aren't whining endlessly about the GC are actually doing with it.

Personally, I blame the OS/Game crowd for single-handedly keeping D out of the web service space for the past decade because, instead of improving the GC to the point that long-running processes are possible, we've built a mountain of (mis)features designed to assuage their demands. I maintain that this was probably the second biggest mistake in D's history.

We need to accept a fact that I learned at DConf 2017, the no-GC crowd will not be silenced until the GC is removed from the language. However, Walter has said the GC is here to stay. Therefore, the no-GC crowd will never be silenced. We've given them a plethora of tools to work without the GC. It is time that we stopped giving them so much our time. We have bigger problems to solve.

I am sure some people on this forum would refer me as "one of them" - and, by default, someone that "wants control of memory" being labeled as ignorant. That makes me the guy in the middle, right?

I think some people are viewing this as black or white. You love the GC or you hate it. This isn't some kind of religious group. Those that might categorize me as some OOP/GC hater, I could say the same for those that want to force the GC it on me.

I have D programs on servers. Some using a rich set of features... shock.. uses the GC. For others, they are written in BetterC.

What we have to remember is, in my opinion, is the Dlang is a unique programming language. Dlang has the opportunity of winning over many different sections of programmers. This is something other languages, especially higher level ones, do not have. If you want to go down the route of "but if you want to write a game or OS... this is not for you" seems like you are enforcing what you want from D and excluding users/developers who need to solve other problems. It isn't just you, but others who are web guys or app guys are happy to join in and agree.

I am not being bitter about it. The core team behind D are free to push whatever goals they wish for the language. If you want to go the route of "no gamers or OS guys" then make it clear. People are going to be argumentative about it on forums and it is not because "no-GC crowd will never be silenced" -- it is because people on this forum really care about the D programming language. I will agree that some people could word their points of view more professionally (and more respecfully of others) -- but you can tell that a number of members on this forum would take a bullet for D.

State the goals of D. Some people will dislike it and create posts about it but at the end, it comes down to 2 choices:-

  1. Accept the goals and keep using D, or
  2. Accept defeat and move to another language.

Maybe there is truth behind it. Is D the language for gamers or OS'ers? With Rust entering the Linux and Windows Kernel space... and we have game-specific languages like Odin or Jai... maybe D is not the right choice for these afterall. If the Non-GC guys are that much of a burden, maybe a chat with Walter should happen sooner than later.

April 04
I have argued for many years that D can scale, and that is a good thing.

Sometimes GC is right (especially for business logic), other times you need full control and are talking to the cpu directly about memory.

At one point I even got Walter to agree that someone is allowed to work on adding write barriers (opt-in) so a more advanced GC could be written, although nobody has done it.

Yet my stuff is -betterC.

I argue that reference counting should be used exclusively for system resources and be part of the language so that we can take full advantage of it, but argue that business logic should be GC based simultaneously.

It certainly isn't black or white! Its a scale of values and multiple may be in use at any given time and that is a desirable trait of D.
April 04
On Thursday, 4 April 2024 at 06:35:49 UTC, Richard (Rikki) Andrew Cattermole wrote:
>
> On 03/04/2024 10:28 PM, rkompass wrote:
>> On Tuesday, 2 April 2024 at 14:50:19 UTC, Richard (Rikki) Andrew Cattermole wrote:
>>> On 03/04/2024 2:23 AM, Guillaume Piolat wrote:
>>>> If you want to use GC and be portable, then (currently in D today) you have to write your own D runtime. Of which there is 3 or 4 custom ones!
>>>
>>> And worse still they each have to implement the compiler hooks, when all they really need to implement is stuff like allocation of memory!
>>>
>> 
>> Is this the reason why there is no D for Arduino?
>> 
>> (Which would be a big + in terms of popularity).
>
> No. Although it hasn't helped.
>
> Micro's tend to be on the small size, all the extra metadata you need for D code like ModuleInfo and TypeInfo could easily exceed that budget or bump you up into one of the more expensive micros killing D off as a possible language.
>
> About the max you'd want here is -betterC which already works.

Yet many stuff is still possible without taking the GC out of the picture.

https://blog.arduino.cc/2019/08/23/tinygo-on-arduino/

https://www.hackster.io/alankrantas/tinygo-on-arduino-uno-an-introduction-6130f6

https://tinygo.org/docs/reference/microcontrollers/

https://www.electromaker.io/blog/article/tinygo-brings-golang-to-microcontrollers

Now imagine if all those Maker magazines and events would be adopting D instead.
April 04

Why doesn't the D language have a fully concurrent, pause-free GC? Look at SGCL, experimental tracked pointers library for C++. I've developed this library and can share insights on how such a GC engine works.

April 04

On Thursday, 4 April 2024 at 09:32:10 UTC, Sebastian Nibisz wrote:

>

Why doesn't the D language have a fully concurrent, pause-free GC?
[...]

I believe the reason is that the GC was designed before the multi-core era (or maybe at the very beginning), so STW was less a problem than todays. Then nobody proposed anything new.

April 05
On 05/04/2024 3:10 AM, user1234 wrote:
> On Thursday, 4 April 2024 at 09:32:10 UTC, Sebastian Nibisz wrote:
> 
>     Why doesn't the D language have a fully concurrent, pause-free GC? [...]
> 
> I believe the reason is that the GC was designed before the multi-core era (or maybe at the very beginning), so STW was less a problem than todays. Then nobody proposed anything new.

People have proposed plenty of new GC stuff over the years.

But to summarize:

For newer GC designs, you need write barriers. They are approved as an opt-in feature.

Nobody has added support nor written a new GC.

It simply comes down to man power, nobody is willing to do the work.

There just isn't enough of a win here to make anyone motivated to do it.

We'd need funding to try and get a student or two to tackle it long term.
April 04

On Thursday, 4 April 2024 at 04:01:56 UTC, cc wrote:

>

Seriously though, what an asinine opinion. Excluding an entire market, to satisfy your religious opinions on memory management. Nobody has stopped anyone from improving the GC. By all means, please improve the GC. I develop commercial games in D, I have come to avoid the GC much of the time, and I'm pretty sure I haven't spent any of the past 10 years of my workload getting in your way of making the GC the best it could be. I simply haven't been using it. Oh no, someone exposed GC.free and __delete as a hacky temporary stopgap? Gosh, that 30 seconds of work sure did get in the way of a decade of someone else making that thing I want better.

I think you're taking the wrong thing from this conversation. You're helping to make the case that the anti-GC crowd is wrong. For me, the problem is that the anti-GC zealots make the following claims:

  • The GC gets in the way. It needs to be removed the way Rust removed theirs for performance reasons.
  • D isn't suitable as a systems programming language because it has a GC.
  • GC should be removed as the default because it leads to bad practice.
  • All D programs have to use the GC.

These things appear on Reddit, Hacker News, etc. etc. any time D is discussed, and it has an effect. Convincing someone to use the GC might be right on paper in some cases, but in practice it doesn't work if the other side has a fundamentalist viewpoint that the GC has to be removed entirely. You can see it in the comments on the story: "That's a valid point, but..."

I do think we need to be realistic and realize that the anti-GC crowd has found its love and they've married Rust or they've decide that C++ is a flawed but good enough spouse. That battle is over. D needs to worry about folks that like C (D makes it realistic for them to keep writing the code they like writing) and folks that like GC (the story's probably not as good as it could be).

I'll also add that I use SafeRefCounted a lot, so I'm also avoiding D's GC much of the time rather than forcing the GC into everything I do.

April 04

On Thursday, 4 April 2024 at 14:32:58 UTC, bachmeier wrote:

>

I'll also add that I use SafeRefCounted a lot, so I'm also avoiding D's GC much of the time rather than forcing the GC into everything I do.

Interesting, could you expand on your wider thinking about doing this?

April 04

On Thursday, 4 April 2024 at 14:32:58 UTC, bachmeier wrote:

>

On Thursday, 4 April 2024 at 04:01:56 UTC, cc wrote:

>

Seriously though, what an asinine opinion. Excluding an entire market, to satisfy your religious opinions on memory management. Nobody has stopped anyone from improving the GC. By all means, please improve the GC. I develop commercial games in D, I have come to avoid the GC much of the time, and I'm pretty sure I haven't spent any of the past 10 years of my workload getting in your way of making the GC the best it could be. I simply haven't been using it. Oh no, someone exposed GC.free and __delete as a hacky temporary stopgap? Gosh, that 30 seconds of work sure did get in the way of a decade of someone else making that thing I want better.

I think you're taking the wrong thing from this conversation. You're helping to make the case that the anti-GC crowd is wrong. For me, the problem is that the anti-GC zealots make the following claims:

  • The GC gets in the way. It needs to be removed the way Rust removed theirs for performance reasons.
  • D isn't suitable as a systems programming language because it has a GC.
  • GC should be removed as the default because it leads to bad practice.
  • All D programs have to use the GC.

These things appear on Reddit, Hacker News, etc. etc. any time D is discussed, and it has an effect. Convincing someone to use the GC might be right on paper in some cases, but in practice it doesn't work if the other side has a fundamentalist viewpoint that the GC has to be removed entirely. You can see it in the comments on the story: "That's a valid point, but..."

I do think we need to be realistic and realize that the anti-GC crowd has found its love and they've married Rust or they've decide that C++ is a flawed but good enough spouse. That battle is over. D needs to worry about folks that like C (D makes it realistic for them to keep writing the code they like writing) and folks that like GC (the story's probably not as good as it could be).

I'll also add that I use SafeRefCounted a lot, so I'm also avoiding D's GC much of the time rather than forcing the GC into everything I do.

There is no anti-GC crowd

I will not speak for other people, so i will speak for myself

I advocate for: GC as a library and core language as pay as you go, so i can use a great language without people making it annoying to use

Imagine:

int[] myarray;
create_array(allocator, myarray, length: 16);


int[int] mymap;
create_map(allocator, mymap)


// or fall back to using GC for casual scripting

No need to pick a clan, be smart, enable people

There is no reason to require the GC to report errors for example, this is beyond stupid

The absolute best is what Zig is doing by encouraging people to use/request for an allocator

The pro-gc people love to enforce the GC everywhere that's not needed, and when people start having issues with it, everyone becomes silent

import core.memory;
import std.stdio;
import std.conv;
import std.datetime.stopwatch;

string[int] stuff;

void main()
{
    for (int i = 0; i < 10_000_000; i++)
        stuff[i] = "hello_" ~ to!(string)(i);

    auto sw = StopWatch(AutoStart.yes);
    auto a = new ubyte[512_000_000];
    writeln(sw.peek.total!"seconds");
}

Question to pro-GC crowd, why does it take 2 seconds to create the array?

April 04

On Thursday, 4 April 2024 at 15:07:23 UTC, Carl Sturtivant wrote:

>

On Thursday, 4 April 2024 at 14:32:58 UTC, bachmeier wrote:

>

I'll also add that I use SafeRefCounted a lot, so I'm also avoiding D's GC much of the time rather than forcing the GC into everything I do.

Interesting, could you expand on your wider thinking about doing this?

What I mean is that a lot of memory I use is allocated either by C libraries or by R's garbage collector. SafeRefCounted takes care of all the details for me so I don't have to think about it.