Namespaces are private bundle and body contexts, allowing multiple files to define the bundles and bodies with the same name, without conflict.

To isolate a file into its own namespace, you add a control promise to the file before the relevant bundles or bodies. All files start off in the default namespace if you don't explicitly set this. Once set, this applies until the end of the file or the next namespace change.

    body file control
       namespace => "myspace"; 

To distinguish the bundle mymethod in the default namespace from one in another namespace, you prefix the bundle name with the namespace, separated by a colon.


      "namespace demo" usebundle => myspace:mymethod("arg1");
      "namespace demo" usebundle => mymethod("arg1","arg2");

To distinguish a body from one in another namespace, you can prefix the body name with the namespace, separated by a colon.

          create => "true",
           perms => name1:settings;

The default namespace, i.e. that which is implied by not making any namespace declarations, can be accessed or referred to by prefixing with the default string

         create => "true",
          perms => default:settings;

For example, this can be used to refer to standard library objects from within a private namespace. Global classes are not handled by namespaces, and you are advised to prefix them with the namespace like this:

         create => "true",
         action => if_repaired("namespace_done");

This is not prepended automatically because references to this class in class expressions cannot be detected and modified automatically.

To access classes, variables, or meta-data in bundles in a different namespace, use the colon as a namespace prefix:


Note that this means that if you are in a namespace that's not default, you must qualify classes from default fully:

   "do something" ifvarclass => "default:myotherclass";