[Omake] variable capture in anonymous functions
Christopher L Conway
cconway at cs.nyu.edu
Tue Mar 18 16:52:26 PDT 2008
Aleksey,
Thanks for the suggestion. But...
$ cat OMakefile
X = re
Y = flux
F = $(fun X, Y, $(addsuffix $(protected.Y), $(protected.X)))
println( $(F foo, bar) )
$ omake
make[0]: Entering directory `/media/sda6/src/tests/omake/omake.8'
*** omake: reading OMakefiles
fooflux
*** omake: finished reading OMakefiles (0.02 sec)
*** omake: done (0.02 sec, 0/0 scans, 0/0 rules, 1/33 digests)
That's weird!
Chris
On Tue, Mar 18, 2008 at 7:36 PM, Aleksey Nogin <anogin at hrl.com> wrote:
> Chris,
>
> Sorry for taking so long for me to respond.
>
> Yes, this is a very well-known bug and it's fixed in 0.9.8.x SVN (the
> upcoming 0.9.8.6 release will change the syntax of the "fun" function).
>
> A temporary workaround is to use $(protected.X) in the body - this will
> tell OMake which "X" to look for...
>
> Aleksey
>
>
>
> On 04.03.2008 20:15, Christopher L Conway wrote:
>
> > I'm seeing variable bindings from the surrounding scope override
> > parameter bindings in anonymous functions. Is there something I am
> > missing about the scoping rules?
> >
> > $ cat Omakefile
> > X = zanzi
> >
> > apply($(fun X, $(println $(X)bar)), foo)
> > apply($(fun Y, $(println $(Y)bar)), foo)
> >
> > $ omake
> > make[0]: Entering directory `/media/sda6/src/tests/omake/omake.8'
> > *** omake: reading OMakefiles
> > zanzibar
> > foobar
> > *** omake: finished reading OMakefiles (0.02 sec)
> > *** omake: done (0.02 sec, 0/0 scans, 0/0 rules, 0/33 digests)
> > $ omake --version
> > OMake 0.9.8.5 (release 2):
> > build [Wed Aug 8 09:10:36 2007]
> > on wagstaff
> >
> > Default library directory : /home/chris/tools/lib/omake
> >
> > Thanks,
> > Chris
> > _______________________________________________
> > Omake mailing list
> > Omake at metaprl.org
> > https://lists.metaprl.org/mailman/listinfo/omake
> >
>
>
> --
> Aleksey Nogin, Research Scientist
> Advanced Technologies Department, Information & System Sciences Lab
> HRL Laboratories, LLC, Malibu, CA
> _______________________________________________
> Omake mailing list
> Omake at metaprl.org
> https://lists.metaprl.org/mailman/listinfo/omake
>
>
More information about the Omake
mailing list