Next: , Previous: Templates, Up: Template Writing

5.3 Context

Each template belongs to a context. When promting for a template by name, such as with C-c / /, the name is prefixed by the current context. If there is no context, it defaults to declaration.

You can change context like this:

     context NAME

where name is some symbol that represents any context.

A context resides over all templates that come after it until the next context statement. Thus:

     context C1
     
     template foo
     "Foo template in C1"
     ----
     ----
     
     context C2
     
     temlate foo
     "Foo template in C2"
     ----
     ----

creates two foo templates. The first one is when in context C1. The second is available in context C2.

This is useful if there are multiple ways to declare something like a function or variable that differ only by where it is in the syntax of the lanugage. The name foo is not ambiguous because each is in a different context.