[Omake] Export scoping / function passing question

Brian Downing bdowning at lavos.net
Fri Dec 25 14:43:55 PST 2009


Another question.  Why does the following behave as it does (again
with 0.9.8.5)?

DefineCommandVars()
OMakeFlags(--verbose)

.SUBDIRS: .
    F = no
    pass(fn) =
        apply($(fn))
        println($F)                      # why is $F "no" here...
        export F
    f() =
        println(f ran)
        F = yes
        export F
    .DEFAULT:
        section
            pass($(getvar f))
            println($F)
            apply($(getvar f))
            println($F)                  # when it is "yes" here?

In both cases it is directly after an apply with the same value, so
it seems wrong to me.  Is there a workaround?  I'd like to be able to
pass a function into another and still be able to export variables.
(In this case I think I can compute and return a map with the values I
want in it, but in general I'd like not to have to.)

In general I have had troubles with omake's mostly-pure-functional
behavior.  I'd like to compute a lot of my make rules automatically from
(high-level) package dependency information, but problems like the above
make it difficult to get all the information required to do so together
in one place.

(Also, is $(getvar f) the only way to get the value of a zero-argument
function?  $(f) calls it, obviously...)

Thanks,
-bcd


More information about the Omake mailing list