Colin wrote:
> 2. I've gotten into the habit of starting all functions like this:
>
>  myfunc: func [.... /local aa bb cc dd]

Why not get Rebol do the work for you?

Fun: function [
    "Automatic local word generation for a function." [catch]
    Spec [block!]    {Optional help info followed by arg words (and optional
type and string).}
    Body [block!]    "The body block of the function."
    ][
    Locals LocalRefinement
    ][
    throw-on-error [
        Locals: make block! 0
        if found? LocalRefinement: find Spec /local [
            insert tail Locals next LocalRefinement
            Spec: copy/part Spec LocalRefinement
            ]
        foreach Value Body [
            if all [
                set-word? :Value
                not found? find Spec to refinement! :Value
                ][
                insert tail Locals to word! :Value
                ]
            ]
        Locals: exclude Locals Spec
        function Spec Locals Body
        ]
    ]

I hope that helps!

Andrew Martin
ICQ: 26227169 http://members.nbci.com/AndrewMartin/
-><-


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

Reply via email to