[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ruby-talk
Subject:    Re: DesignByContract (was RE: utilizing ++ and -- for comments)
From:       gabriele renzi <rff_rff () remove-yahoo ! it>
Date:       2005-02-17 8:19:53
Message-ID: ZoYQd.36678$lB4.991597 () twister1 ! libero ! it
[Download RAW message or body]

itsme213 ha scritto:
> "Florian Gross" <flgr@ccan.de> wrote in message
> news:37hrmgF5cpfeaU1@individual.net...
> 
>>I think I'll use an interface like this:
>>
>>class MyArray
>>   def pop() ... end
>>
>>   check :pop, :pre do
>>     size > 0
>>   end
> 
> 
> Wondering if you have a way to do these ...
> 
> How would the check :pre get access to the method parameters?
> 
> And how would the check :post access the return, or the params, or the
> initial values (instance vars etc.)?

I guess florian would overwrite the method #pop with a new one which 
does bot the pre-code and the original code. Mauricio Fernandez showed a 
nice approach to this which did not need eval() quite a long time ago 
(even if he presented it as poor man's AOP)

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic