Idomatic way to guarantee to run destructor?

kinke kinke at gmx.net
Mon May 4 16:59:31 UTC 2020


On Monday, 4 May 2020 at 11:50:49 UTC, Steven Schveighoffer wrote:
> I'm not sure if Ali is referring to this, but the usage of 
> scope to allocate on the stack was at one time disfavored by 
> the maintainers. This is why std.typecons.scoped was added (to 
> hopefully remove that feature).
>
> Though, if dip1000 ever becomes the default, allocating on the 
> stack could be a valid optimization.

It's not an optimization, it's the status quo for years, although 
apparently not properly spec'd. And unlike the `scoped` library 
solution, `scope` is lightweight and works with -betterC too.


More information about the Digitalmars-d-learn mailing list