D 2015/2016 Vision?

ponce via Digitalmars-d digitalmars-d at puremagic.com
Wed Oct 7 00:35:03 PDT 2015


On Wednesday, 7 October 2015 at 07:24:03 UTC, Paulo Pinto wrote:
>
> That no, but this yes (at least in C#):
>
> using (LevelManager mgr = new LevelManager())
> {
>      //....
>      // Somewhere in the call stack
>      Texture text = mgr.getTexture();
> }
> --> All level resources gone that require manual management gone
> --> Ask the GC to collect the remaining memory right now
>
> If not level wide, than maybe scene/section wide.
>
> However I do get that not all architectures are amendable to be 
> re-written in a GC friendly way.
>
> But the approach is similar to RAII in C++, reduce new to 
> minimum and allocate via factory functions that work together 
> with handle manager classes.
>
> --
> Paulo

This is similar to Scoped!T in D. But this is not composable 
either.
You cannot have a "using()" field in a class object, much like 
you cannot have a Scoped!T field in D. In C#, you still have to 
implement IDispose interface AFAIK.




More information about the Digitalmars-d mailing list