Changes by: Jason Hickey (jyh at cs.caltech.edu)
Date: 2005-07-05 20:02:55 -0700 (Tue, 05 Jul 2005)
Revision: 1189
Log message:

      Continuing with experimenting with scoping.  This compiles and surely
      doesn't work.
      
      Here is the current model.
      
         - Kinds of variables:
              private : local to an object/file, statically scoped.
              protected : object fields, dynamically scoped.
              public : class fields, dynamically scoped.
      
           By default, variable definitions are protected.
      
         - Directives:
      
              include <file> : include the file as if it were inlined in
                 the current environment; you get public and protected
                 variables, but not private.
              open <file> : include at-most-once, in the Pervasives
                 environment, you get only the public variables,
                 the variables are *not* part of the current object.
              extends <file-or-object> : the usual inheritance directive,
                 like open, but protected variables become part of the
                 current object.
              import <file-or-object> : just get the file object.
      
           The <file> and <file-or-objects> do not have to be a constant.
           Linking is performed right afterwards.
      
           If the <file> is a constant, it defines an object
           of that name.  For example,
      
              open build/C
      
           will open the <OMAKEPATH>/build/C file, and it will also define the
           "C" variable.  If the filename is not a constant, this doesn't
           happen.
      
      Implementation:
      
         - There is a link step following an include/open/extends.
           Variables are references(!) that are set during the link step.
           It is only the variable names; the language remains functional.
      
         - Public variables are class variables.  This has little impact
           since the language is functional, but it does mean that some
           aliasing happens.
      
               X. =
                  public.foo = 1
      
               open $(X)
      
               Y = $(X)
               foo = 2 # This is the X.foo field
               println($(Y.foo))   # Prints "2"
      
           This would not be true for protected variables, but "open"
           has no effect on protected variables.
      
               X. =
                  protected.foo = 1
      
               open $(X)
      
               Y = $(X)
               foo = 2               # This is not the X.foo field
               println($(X.foo))     # Prints "1"
               println($(Y.foo))     # Prints "1"
      
         - Every object gets a public section for all its public vars.
      

Changes  Path
+8 -7 omake-branches/strictscope1/src/build/omake_builtin.ml
+0 -3 omake-branches/strictscope1/src/build/omake_builtin_object.ml
+45 -12 omake-branches/strictscope1/src/env/omake_command_digest.ml
+374 -341 omake-branches/strictscope1/src/env/omake_env.ml
+21 -20 omake-branches/strictscope1/src/env/omake_env.mli
+179 -71 omake-branches/strictscope1/src/env/omake_ir_ast.ml
+4 -14 omake-branches/strictscope1/src/env/omake_ir_ast.mli
+2 -2 omake-branches/strictscope1/src/env/omake_ir_free_vars.ml
+5 -5 omake-branches/strictscope1/src/env/omake_ir_semant.ml
+129 -68 omake-branches/strictscope1/src/eval/omake_eval.ml
+3 -3 omake-branches/strictscope1/src/eval/omake_eval.mli
+17 -25 omake-branches/strictscope1/src/eval/omake_rule.ml
+0 -6 omake-branches/strictscope1/src/eval/omake_value.ml
+82 -24 omake-branches/strictscope1/src/ir/omake_ir.ml
+7 -5 omake-branches/strictscope1/src/ir/omake_ir_print.ml
+3 -3 omake-branches/strictscope1/src/ir/omake_ir_util.ml
+0 -1 omake-branches/strictscope1/src/ir/omake_symbol.ml
+7 -6 omake-branches/strictscope1/src/main/omake_shell.ml