Hi,

I missed the design by contract script? Could any of you guys mail it to me?

Thanks,

Maarten
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, February 21, 2001 9:10 PM
Subject: [REBOL] Re: Design by contract


> Gisle Dankel wrote:
> >  Here's a Design By Contract script that I hacked together yesterday.
> >  For those who don't know, Design By Contract is a software pattern used
to
> >  enforce preconditions and postconditions of a function.
> >  <snip>
>
> Thanks for this script. Tools for validating parameters are something
sadly
> lacking in Rebol as it stands today, and could do with being built into
the
> language. If Carl were to look at Eiffel he'd get an idea of the strength
> that such inbuilt capability would bring.
>
> As I try to write robust code, I typically find myself writing stuff like
> this little function:
>
> UpdateTuple: func [
>                    "Add/Subtracts M from the Nth part of a tuple"
>                    Tup [Tuple!] "Tuple to update"
>                    Nth [Integer!] "Nth part of tuple (leftmost is 1)"
>                    Val [Integer!] "Value to add/subtract from Tuple"
>                    ]
>   [
>  either all [(Nth > 0)
>              not (Nth > Length? Tup)
>             ] ; all
>
>             [poke tup Nth ((pick tup Nth) + val)
>
>             ] ;either true
>             [
>                CrashOut "UpdateTuple" "Nth is out of range"
>             ] ; either false
> ]; func
>
>
> I give Rebol top marks for built-in documentation and parameter type
> specification. That's the first seven or so lines of the above function.
But
> the payload (a single line) is then embedded in another seven or so lines
of
> parameter checking. In Eiffel, the payload and the parameter checking
would
> be distinct.
>
> (Crashout is another little function of mine, not shown, that tries to
> shutdown gracefully while advising the user not to panic).
>
> Colin
> --
> To unsubscribe from this list, please send an email to
> [EMAIL PROTECTED] with "unsubscribe" in the
> subject, without the quotes.
>

-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.

Reply via email to