DIP1000: Scoped Pointers (Discussion)
Dicebot via Digitalmars-d
digitalmars-d at puremagic.com
Mon Aug 15 03:11:10 PDT 2016
On 08/15/2016 12:32 PM, Kagamin wrote:
> On Sunday, 14 August 2016 at 20:02:35 UTC, Walter Bright wrote:
>> auto r = range;
>
> You said that if a value (range in this case) is returned by scope, its
> lifetime is restricted to its expression, hence it can't be assigned to
> a variable, because the variable outlives the expression.
As far as I understood Walter, his explained behaviour should happen if
function is NOT annottated with scope and will be a default out-of-box
one when trying to "borrow" stack-allocated data. Not sure yet how it
should work with more complex cases (i.e. container stores a slice /
pointer internally and not just int).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20160815/5556ff72/attachment-0001.sig>
More information about the Digitalmars-d
mailing list