escaping pointer to scope local array: bug or not?

Robert Jacques sandford at jhu.edu
Tue Aug 18 10:48:23 PDT 2009


On Tue, 18 Aug 2009 10:38:50 -0700, Steven Schveighoffer  
<schveiguy at yahoo.com> wrote:

> On Tue, 18 Aug 2009 13:34:36 -0400, bearophile  
> <bearophileHUGS at lycos.com> wrote:
>
>> Steven Schveighoffer:
>>> Another way is to perform escape analysis, but Walter has expressed  
>>> that
>>> he doesn't want to do that.  It would require an intermediate interface
>>> language for imports where annotations could be added by the compiler.
>>
>> Why is that bad?
>
> I don't think it's bad, but definitely a lot of work.  I would be all  
> for it.
>
> -Steve

Actually, it's really bad. Escape analysis requires whole program  
analysis. It would be impossible to do incremental compilation or to  
ship/sell D libraries in binary format. I'd recomend checking out  
http://en.wikipedia.org/wiki/Escape_analysis for an overview of the issues  
involved. You can avoid doing whole program analysis by introducing  
ownership types and being a bit conservative in what you allow. There's a  
(bit confusing) wiki page proposal an how to implement it at  
http://www.prowiki.org/wiki4d/wiki.cgi?OwnershipTypesInD.



More information about the Digitalmars-d mailing list