[Dlang-study] [lifetime] Few root decisions to take on RC classes
Martin Nowak
code at dawg.eu
Sun Nov 1 13:14:43 PST 2015
On Wednesday, 28 October 2015 at 00:45:00 UTC, Andrei Alexandrescu wrote:
> @rc class Widget {
> ...
> }
Copied post from http://forum.dlang.org/post/n15trm$2r5h$1@digitalmars.com.
Let's think about this more clearly before we bake a monolithic feature
for a single problem into the language.
A few thoughts:
- @rc and @noescape are orthogonal
while @rc requires @noescape the latter could
be useful for other purposes
- If the compiler knows a reference has a limited lifetime
it could check for @noescape making most of RC implementable
in a library.
struct RC
{
Object get() return; // lifetime of Object is bound to RC, compiler
could check any function called on Object for @noescape
}
- I'm not a fan of adding yet another attribute but as inference support
is currently limited it seems we'd need an explicit attribute for
public APIs.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.puremagic.com/pipermail/dlang-study/attachments/20151101/15a89184/attachment.sig>
More information about the Dlang-study
mailing list