DIP60: @nogc attribute

Adam Wilson via Digitalmars-d digitalmars-d at puremagic.com
Wed Apr 16 15:42:23 PDT 2014


On Wed, 16 Apr 2014 04:50:51 -0700, Manu via Digitalmars-d  
<digitalmars-d at puremagic.com> wrote:

> I am convinced that ARC would be acceptable, and I've never heard anyone
> suggest any proposal/fantasy/imaginary GC implementation that would be
> acceptable...
> In complete absence of a path towards an acceptable GC implementation,  
> I'd
> prefer to see people that know what they're talking about explore how
> refcounting could be used instead.
> GC backed ARC sounds like it would acceptably automate the circular
> reference catching that people fuss about, while still providing a  
> workable
> solution for embedded/realtime users; disable(/don't link) the backing  
> GC,
> make sure you mark weak references properly.

I'm just going to leave this here. I mentioned it previously in a debate  
over ARC vs. GC but I couldn't find the link at the time.

http://www.cs.virginia.edu/~cs415/reading/bacon-garbage.pdf

The paper is pretty math heavy.

Long story short, Tracing vs. Ref-counting are algorithmic duals and  
therefore do not significantly differ. My read of the article is that all  
the different GC styles are doing is pushing the cost somewhere else.

ARC may in fact be the most advantageous for a specific use case, but that  
in no way means that all use cases will see a performance improvement, and  
in all likelihood, may see a decrease in performance.

That makes ARC a specialization for a certain type of programming, which  
would then remove D the "Systems" category and place it in a "Specialist"  
category. One could argue that due to the currently non-optional status of  
the GC that D is currently a "Specialist" language, and I would be hard  
pressed to argue against that.

@nogc removes the shackles of the GC from the language and thus brings it  
closer to the definition of "Systems". @nogc allows programmers to revert  
to C-style resource management without enforcing a specialized RM system,  
be it GC or ARC. @nogc might not make you run through the fields singing  
D's praises, but it is entirely consistent with the goals and direction of  
D.

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


More information about the Digitalmars-d mailing list