Function scope arguments

Jacob Carlborg doob at me.com
Mon Jan 14 23:30:02 PST 2013


On 2013-01-15 00:07, Timon Gehr wrote:

> 'in' is 'const scope'.
>
> 'scope' is supposed to restrict escaping references, but it is not
> entirely clear what that means, and how to make it powerful enough. Eg.
> what if part of a structure can be freely escaped, such as the contents
> of an array of Objects, but not the array itself? I'd argue that
> indirections in parameters should not be covered by 'scope', because it
> is not something that is transitive. (the opposite would be)
>
> Furthermore, there is the issue of how to treat 'ref' parameters.
>
> Also, we may want to use 'scope' to annotate struct fields in some way,
> so that structs can capture scope parameters that are ensured at the
> call site to live at least as long as the struct instance.
>
> An implementiation should use flow (and maybe lifetime) analysis.

For delegates "scope" indicates the delegate is not a real closure and 
won't capture any variables on the heap.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list