shared - i need it to be useful

rikki cattermole rikki at cattermole.co.nz
Fri Oct 19 08:06:22 UTC 2018


On 19/10/2018 9:02 PM, Walter Bright wrote:
> On 10/17/2018 4:29 AM, jmh530 wrote:
>> Isn't that also true for isolated data (data that only allows one alias)?
> 
> That's colloquially called "unique" data. And yes, it is also true for 
> that. That's why casting the return value of malloc() to 'shared' is 
> safe. It's just that the language has no way to semantically identify 
> unique data with its current type system.

Actually we kind of have a way to do this (I think). Scope. It can't 
cross the thread boundary and it has a pretty clear owner as far as the 
stack is concerned. Given a bit of time and empowering of scope, we 
could do a @scopeonly type attribute for functions.



More information about the Digitalmars-d mailing list