[Omake] variable capture in anonymous functions

Aleksey Nogin anogin at hrl.com
Tue Mar 18 16:36:30 PDT 2008


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


More information about the Omake mailing list