I suggest using a "global" annotation to indicate which names are to be exported to the global object. For example:
"tachyon global: Array" "tachyon global: String"
function Array() { ... } // added to global object function String() { ... } // added to global object
function foo(x) { ... } // not added to global object, but available for static linking
We already have a "tachyon:static" annotation that goes inside the functions (the ECMA standard provides for such annotations). This annotation currently does not eliminate global visibility, but we could simply make it do that.
Question: how does another module know that foo is available for static linking? Must we add another annotation to import statically linkable names? Such as:
Currently, you declare a function static, and it becomes available for linking with everywhere in the Tachyon code. Global lookups of that name in the Tachyon code will link with that function.
That sounds like a C "#ifdef", but at run time. It's kind of dirty, but I guess we can use it until we find something cleaner.
If we make the variable a static definition using my system, the constant propagation should get rid of the branches in the compiled code.
- Maxime