Prototype of Ownership/Borrowing System for D
mipri
mipri at minimaltype.com
Wed Nov 20 07:01:12 UTC 2019
On Wednesday, 20 November 2019 at 06:57:55 UTC, mipri wrote:
> With linear types in ATS there's a special syntax to
> suggest that birthday is giving ownership back to caller
> on return. But without that... this of course works:
>
> @live Person* birthday(Person* p) {
> p.age++;
> return p;
> }
> ...
> p = birthday(p);
As does this:
@live void birthday(scope Person* p) {
p.age++;
}
No new syntax needed because it was already present :)
More information about the Digitalmars-d
mailing list