[Omake] SVN Commit: OMake Build System [0.9.8.x] (Rev. 12512)

Jason J. Hickey jyh at cs.caltech.edu
Fri Nov 2 12:09:26 PDT 2007


This commit makes parameters public (dynamically scoped).
The private policy is unchanged: private variables are not exported.

The problem with private exports is demonstrated by the following program.

   f(x) =
       incr() =
           x = $(add $x, 1)
           export
       y = 1
       incr()
       value $x

We would expect this to work, but it can never work with static scoping
because it would either 1) not export $x, or 2) wipe out $y.

With dynamic scope, it works as it does in 0.9.8.5.  Note that there is
a potential surprise with curried functions.  The same issue comes up
with higher order functions in general.

   curry.f(x) =
      g(y) =
          add($x, $y)

When applied, this will fail with "unbound variable: x" because x is
now out of scope.  This should be documented in the Curry section (and
the solution, which is to add "private.x = $x").

------

Also addressed a long-standing issue with lazy primitive functions.

    f(x) =
        println($x)
    x = 1
    if(true, $(f $x))

In 0.9.8.5, this will result in the error "x = $`x, infinite loop".  The
problem is that lazy primitives implicitly quote their arguments.

    if(true, $`(f $x))

This means you actually pass $`x as the argument to f(x), so now
you have x = $`x.

The solution is to use a non-recursive quote ValStringExp.  There is
overlapping functionality in the recursive and non-recursive quotes.
We should decide whether we need recursive ones (the main reason to
have them is for anti-quotes $,x).

Note, I'm not quite finished; ValStringExp needs to be a closure.
-------

If you don't like either of these, speak now.

----
Changes in omake-branches/0.9.8.x:
    +1 -1       mk/make_gen
    +19 -9      src/builtin/omake_builtin_base.ml
    +7 -1       src/builtin/omake_builtin_object.ml
    +48 -8      src/env/omake_command_digest.ml
    +88 -63     src/env/omake_env.ml
    +8 -7       src/env/omake_env.mli
    +13 -14     src/env/omake_ir_ast.ml
    +17 -6      src/env/omake_ir_semant.ml
    +92 -66     src/eval/omake_eval.ml
    +8 -0       src/eval/omake_value.ml
    +6 -5       src/ir/omake_ir.ml
    +11 -9      src/ir/omake_ir_free_vars.ml
    +20 -22     src/ir/omake_ir_print.ml
    +1 -1       src/ir/omake_ir_util.ml
    +5 -1       src/ir/omake_value_print.ml
    +4 -2       src/ir/omake_value_type.ml
    +1 -0       src/main/omake_shell.ml
    +4 -4       test/OMakefile
    +2 -0       test/curry/Test2
    +2 -0       test/curry/Test3
    +6 -0       test/keyword/Test5
 
A hyperlinked version of this commit is available at
http://svn.metaprl.org/commitlogs/omake/2007-11.html#07/11/02.12:09:26



More information about the OMake-CVS mailing list