[Omake] Scoping

Nathaniel Gray n8gray at caltech.edu
Wed Nov 8 20:40:14 PST 2006


Aleksey Nogin wrote:
> On 08.11.2006 20:22, Nathaniel Gray wrote:
> 
>> I thought I understood the scoping rules, but I don't understand why
>> this works:
>>
>> OCAMLINCLUDES += foo/bar
>> x = $(OCamlProgram a, b)
>>
>> but when you substitute this:
>>
>> FancyOCamlProgram(a, b)
>>     OCAMLINCLUDES += foo/bar
>>     return $(OCamlProgram $(a), $(b))
>> x = $(FancyOCamlProgram a, b)
>>
>> You don't get "-I foo/bar" in the arguments to ocamlc.  Isn't the
>> (re-)definition of OCAMLINCLUDES the closest dynamically-scoped
>> definition during the call to OCamlProgram?
> 
> By default, the variables defined inside functions are private
> (statically scoped) ones. You probably need to use public.OCAMLINCLUDES
> here...

Didn't seem to help.  Here's what I'm actually working on:

     SFProgram(name, files, sfFiles) =
         LocalOCamlGeneratedFiles($(sfFiles))
         public.OCAMLFLAGS += -thread
         public.OCAML_OTHER_LIBS += unix threads lm gc view_change \
                 mcast_lib reliable_multicast
         public.OCAML_LINK_FLAGS += $(mojavecomm)/lib/gc_clib_impl.a \
                 $(mojavecomm)/lib/mcast_clib.a
         public.OCAMLINCLUDES += $(libmojave) $(mojavecomm)/lib \
                  $(dir ../mcomm-lib)
         public.OCAML_LIBS += $(sfgrouplib)
         files += $(sfFiles)
         return $(OCamlProgram $(name), $(files))
     test-a = $(SFProgram test-a, FakeSpec, test1-a)

OMake fails to build FakeSpec.cmi because the includes aren't all there:
- build test FakeSpec.cmi
+ ocamlopt.opt -warn-error A -I . -c FakeSpec.ml
File "FakeSpec.ml", line 1, characters 0-10:
Unbound module SFLog

-n8

-- 
 >>>-- Nathaniel Gray -- Caltech Computer Science ------>
 >>>-- Mojave Project -- http://mojave.cs.caltech.edu -->


More information about the Omake mailing list