# The Factor workspace

## Slava Pestov — 2004-06-08 06:31:28

    Hi all,

    I'm currently working on a 'workspace' feature for improved startup

    speed and transparent persistence.

    In 0.59, it is now stable enough to try out briefly. However, it has

    problems with the compiler. This will be fixed in 0.60. In the meantime

    use the -no-compile switch.

    Try running the interpreter like so (all on one line):

    java -cp factor.FactorInterpreter

         -db:factor.db.BTreeStore:factor.db:64

         -no-compile

    The first time, this will create a b-tree database 'factor.db',

    bootstrap the interpreter and save all objects from the user environment

    to the database. Subsequent times, no source files are read -- the

    database is simply opened and the interpreter begins executing words,

    loading them as necessary.

    Try defining words in a non-default vocabulary, they will persist;

    IN: user

    : hello-world "Hello world" print ;

    ... restart interpreter

    hello-world

    ==> "Hello world"

    The default vocabulary, 'scratchpad', does not persist.

    Variable values are saved as well.

    In particular, the following types of objects are persited:

    - Tables. A table is a persistent namespace, created with <table>

    (workspace vocabulary). Apart from being persistent, it does not differ

    from a namespace created with <namespace> in any way. The global

    namespace is a table. Vocabularies are also tables under the hood.

    - Words and word definitions (except in the scratchpad vocabulary).

    - Any object with a readable representation, such as strings, numbers,

    lists, and so on.

    - Compiled word definitions -- in theory anyway. Don't count on it

    working in this release just yet.

    It is possible that a persitent object might become unreachable -- at

    present, no on-disk garbage collection is performed so it will continue

    taking up space. Also, the b-tree still has bugs and sometimes the

    database is corrupted.

    Slava