Window event changes
	mouseDown & keydown will stay the same to
	preserve the existing code.

	mouseEvent & keyEvent will be added to support
	isDown...

When the mouse goes down, we typically start a control.
Rather than tracking controls, we want a movement event
to send updates to the mouse coordinates. This event
isn't generated when we're not moveing. By eliminating
all non-event periodic functions, we don't use any
CPU when nothing is happening.

**********

Using Contexts as first class objects.

The structure of the interpretive cycle gets changed.
We block a process on the listener waiting for keyevents.
It builds up expressions to parse until it gets the semi
key. Then it compiles a method and executes it by pushing
back a context on the listener process.


The shell process deals with window events.
It pushes back calls to shell cycle so input
events get dispatched. It gets blocked when
nothing is going on.

On machines that don't have a real listener terminal,
the keydown events are sent to the listener class
where they are queued until a semi character is 
received. Then the recursive descent parser is called
to execute the expression.

******
Compile time expressions.
Compile time expressions may depend on previous compile time
expressions. For "OF" clauses, we force the expression to
be valid at compile time and parse meta class references
piece by piece.  For VAR declarations, we create the static
VAR object and push back an assignment expression that sends
a message to evaluate the anonymous method:
First we push back a clean up method that recovers all the
anonymous methods.
Then we push back each assignment as it is encountered.
When the intepreter returns from compiling the file, all
the assignments will be executed. This eliminates the
recursive call to the interpreter.

Summary:
The shell cycle is a message to the system object that we
push back iteratively. When an error occurs, it is thrown
up the stack to a default handler that prints the traceback
and restarts the shellcycle.

The shell cycle includes a method to deal with the listener
window on systems that have a real terminal.  The Listener
is modified to queue characters until the semi is recieved.
Then it compiles the file all at once by pushing back an
expression on the shell process.

Heap scanning can also be done by an iteration on the vm.
We send the system start message and the $activate/$deactivate
messages in this way.

When an instance of an active class is created, we add it to
a list. When a heap is restored, we deactivate these objects..

If a heap is available, it is restored. In this case, the
vm process already exists with handlers in place.

The main routine for alltalk is a call to vmCycle. This call
never returns.

vmCycle executes instructions from the active process.
If no process exists, it recreates a listener process and
opens the default shell window. This would occur if a
user-written shell failed for example.

********************
More on compile-time expressions.

We compile an anonymous method that contains an assignment
or other expression encountered in the code.
This method is pushed back on the stack such that all
pushed back methods are executed in order.
When we finally return from the compiler, all these
expressionn execute in order.

What about recursive INCLUDES?
It is ok to call the compiler recursively because we
don't have to execute any methods during the compilation.

Can the current compiler be modified to test this idea?
No. The stack cannot have pushbacks because it is a true
stack and their is no way to insert other return paths.

********************
How do we get to the new Alltalk?
The old mac version has the right vm.
The old mac version contains modifed methods for
doing the map functions.

We replace the new vm after verifying the new functions.
The old vm will need the new functions for allocating a
method.

After the map functions are replaced we should be in
business.

*******************
What about the new redirectable stdin, stdout, stderr?
These are not a problem.
The method to convert parameters to strings works with
pushbacks and a continuation until all the strings
are collected.

The lex getLine functions will never hang up because
the listener will collect an entire expression before
trying to do a compile.

The compiler will call lex as usual, but the lisRead
function will be reading from a buffer.

The actual polling loop for the listener process is
a normal method pushed back when we restart the vm.
This is a loop that tries to get a char and add it
to a buffer until and endofexpression. It returns
after each call to allow for other continuations?

**********************
The Event loop.
vmCycle pushes back a special interpreter method
when the stack is empty. This method runs the
graphics shell and the Event test loop. If an
Event is ready to run, it pushes itself back
on the stack. When the interpreter loop exits
it will return to the event expression.
When the event expression returns, the stack
will be empty and the interpreter will get
pushed again.  

When the interpreter has gathered a complete
expression, it will push back a call to the
compiler before it returns. 

Could Events be Contexts?
The priority might have some kind of use with
signals. The delay could be used as the time
slice counter...

Events can be Contexts, but we need more than
one queue.  The execution stack is a stack of
contexts. Signals and Event queues are lists
of contexts.

Priorities work as usual...
If a signal is sent to wake up a higher priority
process, we swap the top contexts. A process is
a linked list of Contexts along with with a 
queue link and a priority.

***************************
How will Views deal with multi tasking?
Most operations are atomic, so it may work
out rather well.

**************************
How about the debugger?
The Mac model was never compeleted.
Tracing through sends needs some work.


**************************
Debugger outline

1) We need to relate code positions to source positions both ways.

1.1) Source position to code position is computed by the compiler.
When methods and classes are compiled, the file and line offset
in the file is recored in the data structure.
As a method gets compiled, the code location of each source line
is recorded in a line map for the file:

Assignments to class vars are special anonymous methods that get
created for the metaclass. Each of these methods has a unique
selector for that class. When a class is compiled, all the
compile time expressions get deferred until the compilation is
completed. This makes it possible to compile a class as an
atomic expression.

Recursive calls to the compiler are ok as long as no evaluations
are performed.

Evaluations can be performed if we can save and restore the
state of the compiler. In this way, we could push back
the continuation for the compiler and then push back the
continuation for the expression. We then return to the vm.
The vm will evaluate the expression and then resume the
compilation without explicit recursion.

***************

To save and restore the state of the compiler is not
practical with recursive descent. The who architecture
of the compiler would have to be reconsidered.

An alternative is break up the compilation into parts
that need to have recursion and those that don't.


