Tango vs Phobos

Bruno Medeiros brunodomedeiros+spam at com.gmail
Fri Aug 15 13:44:43 PDT 2008


Sean Kelly wrote:
> == Quote from bearophile (bearophileHUGS at lycos.com)'s article
>> Sean Kelly:
>>> I would prefer that the old behavior the the default and that "new &fn"
>>> or something similar would be used for full closures.
>> We have already discussed why this is negative, when practically possible in D the default has to be
> the "safer" version (what "safer" is can be debated).
> 
> It's just a matter of opinion, I suppose.  As D is a systems language, I don't
> agree with many arguments about safety when that safety conflicts with my
> ability to control what the language is doing behind the scenes.  Portability
> between versions is also an issue--code that is correctly designed for D 1.0
> may be unusable on D 2.0 because the default behavior for certain language
> features is different, although the syntax is still completely legal.  Also, there
> isn't any way to easily grep for the use of delegates so finding such trouble
> spots requires a manual code review.
> 

But does delegate usage cause that much erroneous outer variable heap 
allocation? (by erroneous, I mean in situations were it would not be 
necessary)
Or is the problem here that you are afraid that the developer might make 
a mistake were he would create a delegate that would capture an outer 
variable (and thus heap allocate it), but the developer would not notice it?

Would a semantic tool that detects delegate's outer variables (ie, the 
heap-allocated local variables) be useful? I think it wouldn't be too 
hard to create such functionality in Descent/Mmrnmhrm.

-- 
Bruno Medeiros - Software Developer, MSc. in CS/E graduate
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D



More information about the Digitalmars-d mailing list