@safe(bool)
Manu via Digitalmars-d
digitalmars-d at puremagic.com
Fri Aug 18 20:15:31 PDT 2017
On 18 August 2017 at 02:32, bitwise via Digitalmars-d <
digitalmars-d at puremagic.com> wrote:
> This came to mind while working on a set of containers.
>
> @safety often comes with a performance cost. For example, any container
> that wants to give out a range or iterator has to have a ref-counted or GC
> allocted payload to ensure safety. In a high-performance context though,
> the performance hit may be unacceptable.
>
This sounds like a job for `scope`.
Eg, given a container, the function that returns the range/iterator should
return a `scope` attributed range/iterator. This should insist that the
lifetime of the range that is returned be no longer than the container that
issued it.
We've needed scope to address these issues for a very long time, and it
finally arrived! I'm not sure how far it extends yet though, it's not well
documented yet, and I haven't seen it get a lot of action. I'm not sure
where the boundaries are.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20170819/2c0b66ab/attachment.html>
More information about the Digitalmars-d
mailing list