Unsafe, unchecked message-passing with std.concurrency
Petar
Petar
Thu Aug 27 15:01:13 UTC 2020
On Thursday, 27 August 2020 at 08:59:45 UTC, Elronnd wrote:
> On Thursday, 27 August 2020 at 08:46:31 UTC, Simen Kjærås wrote:
>> Since you're fine with unsafe, unchecked - why not just lie to
>> the compiler? Cast the data to shared and send it on its merry
>> way?
>
> It's bothersome and error-prone. I have to cast the data to
> shared. I also have to remember to receive a shared object on
> the other side (and if I forget, I won't get a compile error,
> stuff will just silently break). Once I've received it, I have
> to cast away the shared again if I want to be able to use the
> object for anything. I'll do that if I have to, (or write my
> message-passing library, or repurpose one from C), but would be
> nice if there were another solution.
The simplest solution is to write your own wrappers of `send` and
`receive` and have them do the casting for you.
More information about the Digitalmars-d
mailing list