[Issue 19097] Extend Return Scope Semantics

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Aug 18 06:42:55 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=19097

--- Comment #4 from Mike Franklin <slavo5150 at yahoo.com> ---
> This situation comes up repeatedly with:
> 1. constructors
> 2. property setters
> 3. put(dest, source) functions

In other words 2 and 3 are functions that return `void`.  Constructors are like
`static` functions that return an object instance, so I'm not sure how the
problem at hand applies to constructors.

> Annotating a parameter with `return` has been quite successful at tracking
scope dependencies from the parameter to the function return value.

The problem with that is we don't have sufficient documentation describing the
semantics of `return` parameters and their relationship with `scope`.  So, I
can't understand how `return` has been used in the past to solve such issues.

So `betty` returns `void`, but a `return` parameter transfers its lifetime to
the function return value.  So I guess that's the nature of this issue.  How
does `return` apply to a function that has no `return` type?

--


More information about the Digitalmars-d-bugs mailing list