[Omake] Documentation example does not work
Aleksey Nogin
anogin at hrl.com
Mon Aug 20 15:31:07 PDT 2007
On 20.08.2007 15:15, Markus Mottl wrote:
> the old example posted on August 9 seems to work fine now, but the new
> one I posted today still seems to be broken:
>
> ------------------
> section
> A = 1
> foo = $(export A)
> export($(foo))
>
> println($(A))
> ------------------
Markus,
The export _function_ is no longer allowed to "penetrate" section
boundaries - only a real export can. It is only allowed to
package/unpackage environments. What you can do to emulate the above
example is the following:
------------------
declare A
env =
A = 1
export(A)
export($(env))
println($(A))
------------------
Note the "declare A" upfront - it is needed in order to "tie" the usage
of A to its definition (otherwise the OMake compiler has no reason to
believe it's the same variable). This is not very important in 0.9.8.5,
but will become increasingly important in future releases.
BTW, the loss in the "indirect exports" functionality in 0.9.8.5 is
offset by the ability to use export statements in arbitrary positions
within a section. E.g.
A =
B = 1
export B
value $(B)
println($A-$B) #prints 1-1
Similarly, you can now have functions that _both_ export and return a value.
Aleksey
--
Aleksey Nogin, Research Scientist
Advanced Technologies Department, Information & System Sciences Lab
HRL Laboratories, LLC, Malibu, CA
More information about the Omake
mailing list