D 2015/2016 Vision?

bitwise via Digitalmars-d digitalmars-d at puremagic.com
Tue Oct 6 10:03:01 PDT 2015


On Tuesday, 6 October 2015 at 06:45:47 UTC, Jonathan M Davis 
wrote:
> On Monday, 5 October 2015 at 23:08:37 UTC, bitwise wrote:
>> Well, again that has it's pros and cons. This is why I just 
>> want a normal language solution like DIP74.
>
> They're not the same thing at all. scoped is supposed to put 
> the class on the stack, not the heap. And it's not ref-counted. 
> It's so that you can create a class object in place, use it, 
> and throw it away without doing any heap allocation. 
> Essentially, it allows you to use a class as if it were a 
> non-copyable struct. Even if we end up with ref-counting 
> supported in the language, it doesn't obviate the need for 
> scoped classes. They're for different use cases.
>
> - Jonathan M Davis


On Monday, 5 October 2015 at 18:18:15 UTC, bitwise wrote:
> The deterministic destruction is actually what I'm after.

For my purposes, they are pretty much the same.

So again, I'll paste the same example:

class Texture { }
class Texture2D : Texture {
     this() { /* load texture... */ }
     ~this { /* free texture */ }     // OOPS, when, if ever, will 
this be called?
}

Memory is not only thing that has to be cleaned up.

     Bit



More information about the Digitalmars-d mailing list