On Saturday, 30 August 2025 at 03:21:14 UTC, Steven Schveighoffer wrote:
`Tid` can only send or receive shared or immutable data. This is a long standing requirement, and it makes sense.

The thing is, this data is shared *only* when it is going through the message system. Once it's out, you can remove the `shared` because the sender has forgotten it.

So the solution is to cast to shared *only* for transmitting. That is, you cast to shared to `send`, and then cast away from shared on the other side after you `receive`.

It is imperative that you forget the data you have sent (the exception) from the sender, as now it can't be considered shared any more.

Also note, that you shouldn't catch the shared exception directly, just catch a normal exception and cast it.

Why require the casting? Because there is no language mechanism to validate a shared piece of data, or anything it contains is not still referenced. We rely on the user to tell the compiler via a cast.

-Steve

I tried various code changes, none of which worked.
Kindly provide code changes to fix warnings that reflect modern D programming.

Reply via email to