DIP71: 'noscope' and 'out!param' attributes
via Digitalmars-d
digitalmars-d at puremagic.com
Sun Jan 18 11:05:36 PST 2015
Some random comments:
I like that it applies to all kinds of references, not just
`ref`. Do you want it to apply to structures with reference
members, too? What about value types in general?
About `out!`: I think this should be placed next to the escaping
parameter for consistency (i.e. `out!p2 T* p1` in your example),
because all other annotations are already at the parameters that
escape.
Instead of `noscope`, I suggest `static`, because that's already
a keyword and will not clash with existing code. (Note that this
can the apply to `this`, and `static` then needs to be placed
behind the function to distinguish it from a static method
declaration, where it appears in front.)
It's a really interesting idea to mark distinguish the different
ways of escaping. This might have further implications, in
particular in relation to purity.
How does this proposal interact with `scope`? It seems you want
the compiler to track lifetimes for all reference parameters,
even those not marked as `scope`. At least your example doesn't
use `scope`.
Apart from that, I'll have to think about a few things. For
example, I don't know yet whether and how a safe owning type/RC
can be implemented with this.
More information about the Digitalmars-d
mailing list