`shared`...

Steven Schveighoffer schveiguy at gmail.com
Mon Oct 1 23:58:19 UTC 2018


On 10/1/18 7:56 PM, Steven Schveighoffer wrote:
> On 10/1/18 7:09 PM, Manu wrote:
>> Your entire example depends on escaping references. I think you missed
>> the point?
>>
> 
> The problem with mutable wildcards is that you can assign them.
> 
> This exposes the problem in your design. The reason const works is 
> because you can't mutate it. Shared is not the same.
> 
> simple example:
> 
> void foo(scope shared int *a, scope shared int *b)
> {
>     a = b;
> }

Haha, of course, this has no effect!

In order for it to show the problem, a has to be ref'd.

-Steve


More information about the Digitalmars-d mailing list