Gregg Irwin wrote:

> Also, what do you think about ordering the parameters to CONTRACT in the
> order that they are applied (as it were): spec pre local body post ?

    I just posted the updated version of dbc.r
    The blocks have been reordered, as you suggested.

    I also added a wrapper, which takes a regular existing function and wraps
    a contract arount it, as in:
        g: wrap-dbc pre :f post
    I might extend it a bit to handle native! functions too.

    Some fiddling was required because a spec copied from a function f,
    such as:
    ["Comment" x [integer!]]
    would get converted by the "make function! spec body" into:
    ["Comment" x [datatype!]]
    Apparently what looked and was printed as 'word was not
    a 'word at all! :-)

    One question: How to programmatically insert line breaks into
    a series of blocks?
    The reason for this  is that I'd like to maintain a neat layout
    of a source code produced by the wrapper. Inside the wrap-dbc
    you will see an ugly trick with empty blocks that almost
    does what I want.
    body: reduce [
            []
            'require pre
            []
            to-set-word 'result 'do fun-body
            []
            'ensure post
            []
            'result
            ]

    Best wishes,
    Jan





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

Reply via email to