-preview=in might break code

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Sat Oct 3 15:41:58 UTC 2020


On Saturday, 3 October 2020 at 14:49:03 UTC, Steven Schveighoffer 
wrote:
> `in ref` is a reference, and it's OK if we make this not a 
> reference in practice, because it's const. And code that takes 
> something via `in ref` can already expect possible changes via 
> other references, but should be OK if it doesn't change also.

Is that still OK in a concurrent or multithreaded context?

     void foo (in ref bar)
     {
         // does something which may yield, and
         // another context can change value
         // underlying `bar`
         ...

         // result of this writeln will now depend
         // on how the compiler treated the `in ref`
         writeln(bar)
     }


More information about the Digitalmars-d mailing list