# Contexts

Contexts are a way to avoid namespaces clashes in different word contexts. Some
units have words with name that are intentionally short because they're intended
to be often called by the user, but short names easily clash.

A context is a fork of the system dictionary and "floaded" LL (the LL that
remembers which unit files are loaded). When you call its name, you activate it.
When you define words in it, they're only in that context. When you load a unit
in it, it's only flagged as "loaded" in that context. You can then easily switch
contexts by calling their names. Example:

    context editor
    f<< /text/ed.fs
    ( do some editing )
    context asm
    f<< /asm/i386.fs
    ( some some compiling, editor words aren't there )
    editor
    ( do some editing again, asm words aren't there )
    system
    ( return to the "system" context )

Context forks are *dynamic*. Words added to contexts, of course, don't affect
other contexts, but words added to the system context *will* be added to all
context ("under" them, context words shadow system words at all times). This can
lead to tricky situations with the word "forget" from mem/dict: If you're in a
context and "forget" past the point of a word definition in another context,
you'll end up corrupting your memory because "forget" rewinds "here" too.

So, never forget past your latest context switch (unless those switches didn't
define any word or allocate any memory).

## API

context ( "name" -- )
  Fork the currently active dictionary (can be another context) and name it
  "name". A new word called "name" is defined, which recalls the context.
  Creating a context activates it.
