Sharing in D

Dee Girl deegirl at noreply.com
Fri Aug 1 12:26:13 PDT 2008


Steven Schveighoffer Wrote:

> shared int *x;
> 
> void foo(shared int *y)
> {
>     x = y;
> }
> 
> int *x2;
> 
> void bar()
> {
>     foo(x2);
> }
> 
> After calling bar, isn't x2 now both shared (as x) and unshared at the same 
> time?  I think you need casts for both ways.
> 
> I think shared/unshared is analogous to mutable/invariant.  There is no 
> implicit cast.

Agree with Steve. There should not be easy casting of pointers. i think cast from not shared int to shared int is good. but int* to shared int* is not good. exactly like with invariant. The new model is very interesting! Good Walter I hoped you have a clever solution like invariant and it looks that you have ^_^. Thank you, Dee Girl



More information about the Digitalmars-d mailing list