Question about contracts on methods.
    Peter C. Chapin 
    pcc482719 at gmail.com
       
    Mon Nov 30 19:42:46 PST 2009
    
    
  
Don <nospam at nospam.com> wrote in news:hf0obf$1th8$1 at digitalmars.com:
>>     void next()
>>     in {
>>         int original_day_m   = day_m;
>>         int original_month_m = month_m;
>>         int original_year_m  = year_m;
>>     }
>>     out {
>>         assert( ... expression using original_day_m, etc ... )
>>     }
>>     body {
>>       // No code related to pre or post conditions.
>>     }
>> 
>> This might not be an ideal resolution but it seems a lot better than
>> the current situation and it doesn't look like it would be too hard
>> to implement (but what do I know!).
> 
> The problem is, where do those variables get stored? The function body
> will overwrite anything that's left on the stack.
Couldn't the compiler just translate the above into something similar to 
your example using nested functions?
Peter
    
    
More information about the Digitalmars-d-learn
mailing list