Escape analysis (full scope analysis proposal)

Robert Jacques sandford at jhu.edu
Sun Nov 2 21:06:09 PST 2008


On Sat, 01 Nov 2008 12:00:10 -0400, Steven Schveighoffer  
<schveiguy at yahoo.com> wrote:
> "Michel Fortin" wrote
>>> The only way I can see to solve this is to do it at link time.  When  
>>> you
>>> link, piece together the parts of the graph that were incomplete, and  
>>> see
>>> if
>>> they all work.  It would be a very radical change, and might not even
>>> work
>>> with the current linkers.  Especially if you want to do shared  
>>> libraries,
>>> where the linker is builtin to the OS.
>>
>> I think you're dreaming... not that it's a bad thing to have ambition,  
>> but
>> that's probably not even possible.
>
> Sure it is ;)  You have to write a special linker.
>
> I think everyone who thinks a scope decoration proposal is going to 1)  
> solve
> all scope escape issues and 2) be easy to use is dreaming :P

Various research languages have shown both 1 and 2 are possible.

>>>> I don't think it's bad to force interfaces to be well documented, and
>>>> documented in a format that the compiler can understand to find errors
>>>> like this.
>>>
>>> I think this concept is going to be really hard for a person to  
>>> decipher,
>>> and really hard to get right.
>>
>> It takes some thinking to get the prototype right at first. But it takes
>> less caution calling the function later with local variables since the
>> compiler will either issue an error or automatically fix the issue by
>> allocating on the heap when an argument requires a greater scope.
>
> I hope to avoid this last situation.  Having the compiler make decisions  
> for
> me, especially when heap allocation occurs, is bad.

How so? Please explain why it's bad (an opinion by itself isn't and  
argument).





More information about the Digitalmars-d mailing list