confusing (buggy?) closure behaviour
    BCS 
    ao at pathlink.com
       
    Fri Dec 12 14:53:48 PST 2008
    
    
  
Reply to Zoran,
> I don't think it is restrictive if the compiler prevented a situation
> that would otherwise lead to a run-time error anyway, or worse, weird
> and confusing run-time behavior. In my case, if the compiler couldn't
> SAFELY handle a reference to the argument n outside the enclosing
> function, then, IMO, RETURNING it (but not otherwise using it) should
> be flagged a compilation error. Admittedly, detecting this is a bit
> more involved for the compiler, but not at all restrictive for the
> user.
> 
D2.0 handles it all correctly. D1.0 follows the "hear is a gun, there is 
your foot" mentality with regards to this. In general D is *not* a safe language 
and that is by intent.
    
    
More information about the Digitalmars-d-learn
mailing list