On Thursday, 15 July 2021 at 13:12:34 UTC, Paul Backus wrote:
>@safe
code can't access __gshared
data.
We're talking about @system code and whether it can be @trusted.
July 15, 2021 Re: Prime sieve language race | ||||
---|---|---|---|---|
| ||||
Posted in reply to Paul Backus | On Thursday, 15 July 2021 at 13:12:34 UTC, Paul Backus wrote: >
We're talking about @system code and whether it can be @trusted. |
July 15, 2021 Re: Prime sieve language race | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sebastiaan Koppe | On Thursday, 15 July 2021 at 13:16:01 UTC, Sebastiaan Koppe wrote: >Yes that is the sensible thing to do. But I am not sure that is the right thing. I am afraid that it will lead to the conclusion that everything needs to be shared, because who is going to stop someone from taking your struct/class/function, moving it over to another thread and then complain it corrupts memory while it was advertised as having a @safe interface? If you share an object between threads, it must be typed as |
July 15, 2021 Re: Prime sieve language race | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sebastiaan Koppe | On Thursday, 15 July 2021 at 13:16:01 UTC, Sebastiaan Koppe wrote: >On Thursday, 15 July 2021 at 12:35:29 UTC, Petar Kirov [ZombineDev] wrote: >On Wednesday, 14 July 2021 at 19:10:55 UTC, Sebastiaan Koppe >Because member functions are harder to call from multiple threads than static functions are. For one, you will have to get the object on two threads first. Most functions that do that require a shared object, which requires a diligent programmer to do the casting. The problem with Yes that is the sensible thing to do. But I am not sure that is the right thing. I am afraid that it will lead to the conclusion that everything needs to be shared, because who is going to stop someone from taking your struct/class/function, moving it over to another thread and then complain it corrupts memory while it was advertised as having a @safe interface? Not quite. If an aggregate has no methods marked as I am afraid that it will lead to the conclusion that everything needs to be shared This is the sort thinking common in languages like C# and Java (at least, in my experience), where you don't know whether your class may be shared across threads, so you either find out eventually the hard way (via bug reports), or (e.g. if requested by code reviewers) you go in and preemptively add locks all over the code (usually not tested well, since you your initial use-case didn't involve sharing the object across threads). This is not the case in D. If your aggregate doesn't have That's why In case of Phobos, (*) (**) Another way to discuss P.S. I use the term "method" when I mean non-static member function, and "aggregate" when I mean |
July 15, 2021 Re: Prime sieve language race | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sebastiaan Koppe | On Thursday, 15 July 2021 at 13:10:44 UTC, Sebastiaan Koppe wrote: >But does that all imply that we have to make all non-threadsafe functions @system? How can we every be @safe? TL;DR of my previous post is "no" as the answer to your question. It's perfectly fine to develop/use Another TL;DR:
|
July 15, 2021 Re: Prime sieve language race | ||||
---|---|---|---|---|
| ||||
Posted in reply to Petar Kirov [ZombineDev] | On Thursday, 15 July 2021 at 17:17:53 UTC, Petar Kirov [ZombineDev] wrote: >[..] You should mark code as @system only if it implicitly uses shared data [..] I mean "only" in the context of multi-threading, other memory/type safety issues not withstanding. |
July 16, 2021 Re: Prime sieve language race | ||||
---|---|---|---|---|
| ||||
Posted in reply to Bastiaan Veelo | On Sunday, 4 July 2021 at 15:31:31 UTC, Bastiaan Veelo wrote: >I don't know when the episode on D will be made, and it might be interesting if multiple solutions using different styles are available. Anyway, tweaks will be accepted until a final comparison in the last episode. -- Bastiaan. Why not ldc2 instead of gdc? |
July 16, 2021 Re: Prime sieve language race | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrea Fontana | On Friday, 16 July 2021 at 08:07:27 UTC, Andrea Fontana wrote: >Why not ldc2 instead of gdc? Solution2 uses ldc2. — Bastiaan. |
July 29, 2021 Re: Prime sieve language race | ||||
---|---|---|---|---|
| ||||
Posted in reply to SealabJaster | On Tuesday, 13 July 2021 at 23:23:56 UTC, SealabJaster wrote: >On Tuesday, 13 July 2021 at 22:11:34 UTC, SealabJaster wrote: >... @_@ Finally decided to run the full benchmark. On my weak linux machine, it comes out at 68(CT) 76(RT) out of 191 for the single threaded version. For the multithreaded we're at 39(CT) and 43(RT) out of 52. I've also managed to get WSL to run it now, so I'll report back on the results from my main machine. |
July 29, 2021 Re: Prime sieve language race | ||||
---|---|---|---|---|
| ||||
Posted in reply to SealabJaster | On Thursday, 29 July 2021 at 07:16:41 UTC, SealabJaster wrote: >... Scratch WSL, it's super weird and kind of awful. Anyway, another PR: https://github.com/PlummersSoftwareLLC/Primes/pull/541 |