Tango vs Phobos

Sean Kelly sean at invisibleduck.org
Fri Aug 15 15:18:48 PDT 2008


Bruno Medeiros wrote:
> 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)

 From what I've been told, it does.  But I haven't personally tested D 
2.0 enough to say.

> 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?

No.  My issue is simply with performance guarantees.

> 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.

Not sure.  I'd have to look into how the compiler decides whether to 
heap allocate before saying.


Sean



More information about the Digitalmars-d mailing list