New attribute to control references

Loara loara at noreply.com
Wed Apr 27 20:33:48 UTC 2022


On Wednesday, 27 April 2022 at 17:12:04 UTC, Dennis wrote:
> On Wednesday, 27 April 2022 at 15:51:36 UTC, Loara wrote:
>> this is not the point, the point is that with a not transitive 
>> `scope` it's still possible to transfer references to non 
>> `scope` pointers without explicit casts.
>
> I think it's unclear what the example is demonstrating then.

That examples were written because I didn't understand many 
features about `scope` since the official documentation wasn't so 
clear. But once I focus on the `synchronized` access to `shared` 
data the initial purpose of these pages have changed and now them 
are no longer useful.

>> A transitive scope is more appropriate for `synchronized` 
>> access to a `shared` variable that contains indirections 
>> rather than a stack allocated object.
>
> I've never thought about using `scope` in combination with 
> shared data, but it's an interesting thing to consider.

Since I don't know if a transitive `scope` would be useful also 
for stack-allocated variables or not, I've chosen the `rscope` 
name only to distinguish it from the standard and not transitive 
`scope` attribute.




More information about the Digitalmars-d mailing list