October 30

On Monday, 30 October 2023 at 16:20:00 UTC, Jonathan M Davis wrote:

>

On Monday, October 30, 2023 1:48:46 AM MDT Sergey via Digitalmars-d wrote:

>

On Sunday, 29 October 2023 at 21:32:18 UTC, Jonathan M Davis

wrote:

>

If you have a good use case, then it may make sense to expose the state information, but as was pointed out in your previous PR, exposing that state information is likely to mislead programmers and risk causing them to write code that has race conditions due to out-of-date state information - and no one reviewing the PR saw how exposing that state information would actually enable anything. So, please provide a use case where exposing that state information actually enables something that you can't do without it.

  • Jonathan M Davis

Hi Jonathan.
The author of the topic came to D from C#. And in the C# they
have this feature. On of the example is to check the status of
the tasks - if it was successfully finished, canceled, killed by
exception.
Some simple example can be found here:
https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.taskstat
us?view=net-7.0

Thanks for the info.

Task in std.parallelism already provides the done property to ask whether a task has been completed (be it successfully or by an exception being thrown). It does not provide any way to cancel tasks, and the functions on Task which deal with actually making it do anything are largely variations on getting the result (be it by getting it because it's already ready, by waiting for it to be completed, or by actually forcing the task to be done on the current thread to get the result). As such, there does not appear to be anything useful which can be done based on the task status except based on whether it's done or not - which Task already provides.

So, with the API that std.parallelism provides, actually making the TaskStatus public does not appear to have any useful purpose, and by its very nature, the answer stands a decent chance of being out-of-date, because once the TaskStatus is outside of the Task, it's just information on what the status was when it was synchronized from the thread that it was on, not information on what the actual, current status is. So, acting on that information risks introducing race conditions (assuming that you can actually do anything with that information), and if you can't actually do anything with that information (and std.parallelism doesn't seem to make it so that you can), then there's no point in exposing it.

It might make sense to expose the TaskStatus with a different API (which C# obviously has if it's going to allow things like canceling tasks), but no one has provided a good reason for why it should be exposed in std.parallelism beyond the done property which already exists. And sadly, Imperatorn has repeatedly decided to get mad with us rather than engage in a technical discussion on why exposing the task's status beyond having the done property would actually be a good idea. It's quite possible that there is something that we are missing, and exposing the TaskStatus actually makes sense, but there need to be technical reasons for that, and none have been presented.

  • Jonathan M Davis

I just have very limited time to explain everything, but I can start.

Given the provided link
https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.taskstatus?view=net-7.0

As you can see it contains TaskStatus.

Canceled 6 The task acknowledged cancellation by throwing an OperationCanceledException with its own CancellationToken while the token was in signaled state, or the task's CancellationToken was already signaled before the task started executing. For more information, see Task Cancellation.
Created 0 The task has been initialized but has not yet been scheduled.
Faulted 7 The task completed due to an unhandled exception.
RanToCompletion 5 The task completed execution successfully.
Running 3 The task is running but has not yet completed.
WaitingForActivation 1 The task is waiting to be activated and scheduled internally by the .NET infrastructure.
WaitingForChildrenToComplete 4 The task has finished executing and is implicitly waiting for attached child tasks to complete.
WaitingToRun 2 The task has been scheduled for execution but has not yet begun executing.

If we divide it in time, short term, middle term and long term changes.

A first change could for example be to expose the status as is, but as discussed earlier, it was not meant to be exposed from the beginning, but via alias this, it was just a mistake. I can understand that, and removing it makes sense.

A middle term change could be to implement a way to get a real status from a task in a correct way, whatever that would mean in D. The implemenation is not important.

A long term change would be a complete rewrite where basically a very detailed status could be probed from the task.

Imagine you have a super loop concept where you check the individual tasks. Now, what does checking a task mean?

In terms of what D could provide it would mean is it started, is it running or is it completed/done/failed/unknown. Much less than C#, but still something.

If you can only check if it's done, you don't know if it hasn't started yet or if it's running. The negation of "done" does not mean that it's running, it could also not be started.

I'm not talking about the current implementation in D. I am talking about a solution where you have a Task and you want to get the status from that task.

You will need to have to imagine a future object that can do this.

Of course I could try and rewrite Task, but it would probably take several weeks because I have barely looked at the code for it.

October 30

On Monday, 30 October 2023 at 19:23:58 UTC, Imperatorn wrote:

>

On Monday, 30 October 2023 at 16:20:00 UTC, Jonathan M Davis wrote:

>

[...]

I just have very limited time to explain everything, but I can start.

[...]

the second you query the status and get 'WaitingToRun' back, that same information is potentially outdated and the task might have started before you do anything with this information. so you cannot rely on it anyway. so what do you need this information for?

October 30

On Monday, 30 October 2023 at 19:37:35 UTC, duckchess wrote:

>

On Monday, 30 October 2023 at 19:23:58 UTC, Imperatorn wrote:

>

On Monday, 30 October 2023 at 16:20:00 UTC, Jonathan M Davis wrote:

>

[...]

I just have very limited time to explain everything, but I can start.

[...]

the second you query the status and get 'WaitingToRun' back, that same information is potentially outdated and the task might have started before you do anything with this information. so you cannot rely on it anyway. so what do you need this information for?

antihelp++;

October 30

On Monday, 30 October 2023 at 19:23:58 UTC, Imperatorn wrote:

>

On Monday, 30 October 2023 at 16:20:00 UTC, Jonathan M Davis wrote:

> >

[...]
I just have very limited time to explain everything, but I can start.

[...]

https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task?view=net-7.0

October 30

On Monday, 30 October 2023 at 19:45:13 UTC, Imperatorn wrote:

>

antihelp++;

What a nice guy.

October 30

On Monday, 30 October 2023 at 19:52:57 UTC, Olaf wrote:

>

On Monday, 30 October 2023 at 19:45:13 UTC, Imperatorn wrote:

>

antihelp++;

What a nice guy.

:)

October 30

On Monday, 30 October 2023 at 19:01:09 UTC, A moo person wrote:

>

A big problem is I have never once seen a job posting asking for D programmers. Tons of jobs still asking for c and cpp, tons of jobs in python or c#, even see postings asking for rust programmers now, but I have honestly never once seen a job posting asking for D programmers and that is with me actually going out of my way to search for them.

It is well known fact. But it doesn't mean a lot actually.
And I know cases when actually D developers were searched with "C++/C#" jobs description :)

>

Nothing lasts forever, I assume eventually all languages will die, but D feels likes the walking dead at this point. All momentum feels like it was drained out over many many years of mismanagement. I can't in good conscious recommend it to people anymore even though I love aspects of the language itself so much.

Recommend people for what? It depends. I think it is quite safe to recommend D for personal project, to have joy and fun. Also if they need to prepare some MVP fast and if all components are available in std/3rd party libraries (check the quality of those libraries not too hard). For something else - it could be harder. I just mean it is not 0/1 question..

>

I had a bit of hope when a while back there was that feedback request campaign, but after I saw the response to it I pretty much lost all hope. I know people here will disagree, I really resisted coming to this conclusion myself because I have sunk a lot of personal time and energy into writing D code. But that's where I am now after 10 years of hobby D programming.

I thought stabilization the lang and fixing bugs were a long-waited wish of many users.
But there will be always 2 sides of the community: who already fine and don't want to break a lot, and who is not yet fine and want to break a lot to be fine as well :)

October 31

On Monday, 30 October 2023 at 20:47:34 UTC, Sergey wrote:

>

On Monday, 30 October 2023 at 19:01:09 UTC, A moo person wrote:

>

A big problem is I have never once seen a job posting asking for D programmers. Tons of jobs still asking for c and cpp, tons of jobs in python or c#, even see postings asking for rust programmers now, but I have honestly never once seen a job posting asking for D programmers and that is with me actually going out of my way to search for them.

It is well known fact. But it doesn't mean a lot actually.
And I know cases when actually D developers were searched with "C++/C#" jobs description :)

Can we stop that btw; like post both a c++ and a d job if youll take either but like can I just have job alerts

October 31

On Tuesday, 31 October 2023 at 01:05:30 UTC, monkyyy wrote:

>

On Monday, 30 October 2023 at 20:47:34 UTC, Sergey wrote:

>

On Monday, 30 October 2023 at 19:01:09 UTC, A moo person wrote:

>

A big problem is I have never once seen a job posting asking for D programmers. Tons of jobs still asking for c and cpp, tons of jobs in python or c#, even see postings asking for rust programmers now, but I have honestly never once seen a job posting asking for D programmers and that is with me actually going out of my way to search for them.

It is well known fact. But it doesn't mean a lot actually.
And I know cases when actually D developers were searched with "C++/C#" jobs description :)

Can we stop that btw; like post both a c++ and a d job if youll take either but like can I just have job alerts

It is very popular practice right now. Even if we are not speaking about D..
Many positions just have something like that: "Proven experience in software development, including proficiency in programming languages such as Java, Python, C++, or others".

October 31

On Monday, 30 October 2023 at 14:30:25 UTC, Imperatorn wrote:

>

On Monday, 30 October 2023 at 14:19:58 UTC, Guillaume Piolat wrote:

>

On Sunday, 29 October 2023 at 12:54:33 UTC, Imperatorn wrote:

>

Can we count on that if we find an issue with D that it will be taken care of? And if so, how, and by whom? That it will not be silently ignored for years? How can we safeguard against that?

By trying to be a net-positive contributor to the D ecosystem and especially core team: libraries, but also mentoring, money, etc. You create the incentives to help your company.
D is a communal effort, without supporting the community and "giving back" D wouldn't exist. It's really quite hard to do well.

Well. I took a quick look at phobos for example.

And it's been almost unchanged since 2019.

We discussed this on Discord trying to understand why.

Some name Andrei "leaving" is a reason, Wilzbach was also a contributor who left. And Jack Stouffer.

Some mentioned that betterC got too much attention and someone else said too heavy focus on nogc slowed things down in general.

I don't know which of these are correct, but it's a bit worrying.

Do you have an explaination to why the number of contributions to phobos has decreased so much since about 2018-2019?

There's plenty of work to be done in Phobos, the issue is finding contributors. We need replacements for std.{json,xml}. I wouldn't mind replacing/updating std.socket either. Robert Schadek's made the case more than once that we need more file formats in there too, which I agree with. Then there's the fact that we're currently concentrating on finishing/stabilising instead of adding new features.

The prerequisite right now in my opinion is finishing allocators and moving them out of experimental. I don't think it makes sense to start work on Phobos v2 before v1 is done, and it isn't. It doesn't help that I need to figure out how to include the library's evolution in the proposal for editions.