DIP60: @nogc attribute

Adam Wilson via Digitalmars-d digitalmars-d at puremagic.com
Fri Apr 18 16:51:50 PDT 2014


On Fri, 18 Apr 2014 16:48:43 -0700, Walter Bright  
<newshound2 at digitalmars.com> wrote:

> On 4/18/2014 3:02 PM, Michel Fortin wrote:
>> Objective-C enables ARC by default for all pointers to Objective-C  
>> objects.
>> Since virtually all Objective-C APIs deal with Objective-C objects (or  
>> integral
>> values), if you limit yourself to Objective-C APIs you're pretty much  
>> memory-safe.
>
> "pretty much" isn't really what we're trying to achieve with @safe.
>
>
>> The point being, D could have managed and unmanaged pointers (like  
>> Objective-C
>> with ARC has), make managed pointers the default, and let people escape  
>> pointer
>> management if they want to inside @system/@trusted functions.
>
> Yeah, it could, and the design of D has tried really hard to avoid such.  
> "Managed C++" was a colossal failure.
>
> I've dealt with systems with multiple pointer types before (16 bit X86)  
> and I was really, really happy to leave that **** behind.
>

Managed C++ was a colossal failure due to it's extreme verbosity. C++/CLI  
and C++/CX are much tighter and more importantly NOT failures. I use  
C++/CLI in production code, and yes, you have to be careful, it's easy to  
get wrong, but it does work.

Note: that I am not advocating this for D and I think that avoiding it is  
the correct approach. But it wasn't a failure once the more obvious design  
flaws got worked out.

-- 
Adam Wilson
GitHub/IRC: LightBender
Aurora Project Coordinator


More information about the Digitalmars-d mailing list