On 2014-04-17 17:29:02 +0000, Walter Bright <newshou...@digitalmars.com> said:
On 4/17/2014 5:34 AM, Manu via Digitalmars-d wrote:
People who care would go to the effort of manually marking weak references.
And that's not compatible with having a guarantee of memory safety.
Auto-nulling weak references are perfectly memory-safe. In Objective-C
you use the __weak pointer modifier for that. If you don't want it to
be auto-nulling, use __unsafe_unretained instead to get a raw pointer.
In general, seeing __unsafe_unretained in the code is a red flag
however. You'd better know what you're doing.
If you could transpose the concept to D, __weak would be allowed in
@safe functions while __unsafe_unretained would not. And thus
memory-safety is preserved.
--
Michel Fortin
michel.for...@michelf.ca
http://michelf.ca