[Dlang-internal] DIP1000 discussion and testing

Walter Bright via Dlang-internal dlang-internal at puremagic.com
Thu Oct 20 22:41:31 PDT 2016


On 10/20/2016 7:57 PM, Martin Nowak wrote:
> For example the most interesting function semantics just refer "See section
> dedicated to discussing methods.", but the Function section
> (https://github.com/dlang/DIPs/blob/6f9f50ee579bd0ccc11e5dfeef035cbbb095e0d9/DIPs/DIP1000.md#functions)
> doesn't contain formal lifetime rules for functions.
> Weirdly the Pointer section
> (https://github.com/dlang/DIPs/blob/6f9f50ee579bd0ccc11e5dfeef035cbbb095e0d9/DIPs/DIP1000.md#pointers)
> seems to contain lifetime rules for function return values.
> At this point the DIP regresses a bit into showing examples with short notes
> whether they are errors or correct.
> It's somewhat difficult to extract a mental model from that.

What you're looking at is I'm not very good at articulating the mental model I 
have for it. I don't know how to write 'formal' rules for these things.


 > The DIP seems to define the lifetime of function return values as the longest
 > lifetime that can be conservatively assumed given the function arguments.

That's right.


 > You mentioned an article and a talk, do you have any cleaner/more detailed
 > explanation for functions @Walter?

I haven't written either, yet, though I need to get busy with it Real Soon Now. 
It'll be informal, obviously, but I plan to use trivial examples to make it as 
clear as possible.

I hate slides with more than about 5 lines of code in them - I lose track of the 
presentation when I'm trying to understand the code, and I presume my audience 
will, too.


More information about the Dlang-internal mailing list