All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class Jaja.Monitor

java.lang.Object
   |
   +----Jaja.Jaja
           |
           +----Jaja.Value
                   |
                   +----Jaja.Symbol
                           |
                           +----Jaja.SpecialOperator
                                   |
                                   +----Jaja.Monitor

public final class Monitor
extends SpecialOperator
This is the (monitor handler forms...) special form. A special form that allows to catch exceptions and to handle them with a specified handler (which is run in the dynamic context of the exception if this exception is continuable).

The monitor special form catches anomalies (aka Jaja exceptions) or Java runtime exceptions. The latter are always non continuable (the stack is unwinded before Jaja gets control again). The former are diagnosed (aka raised in Jaja parlance) in some special circumstances and may be continuable or not. To continue a non continuable anomaly raises another (non continuable) anomaly.

Not all erroneous situations lead to anomalies since that detection is expensive (in time and space). The compiler generates code that performs verifications by simple cast expressions instead of generating type checks. Once one has an ClassCastException, one may read the code of Jaja at the accompanying line number and get an idea of the invalid type error.


Constructor Index

 o Monitor()

Method Index

 o createInitialHandler(Value)
Create a default initial list of handlers.
 o diagnose(Value, Value)
Raise an exception associated to a Jaja boolean telling whether the exception may be continued or not.
 o perform(Value, Environment, WorldAble)
Perform the effect of a monitor special form.

Constructors

 o Monitor
 protected Monitor()

Methods

 o perform
 public Value perform(Value parameters,
                      Environment r,
                      WorldAble world)
Perform the effect of a monitor special form.

Overrides:
perform in class SpecialOperator
 o diagnose
 public static Value diagnose(Value exception,
                              Value continuable)
Raise an exception associated to a Jaja boolean telling whether the exception may be continued or not. When a continuation is continuable, the handler may return a value that will become the value of the call to diagnose.

Exceptions may be raised by the diagnose function. If the exception is continuable then the handler is run in the dynamic context of the exception except that it is now monitored by the handler that was previously current.

 o createInitialHandler
 public static HandlerLink createInitialHandler(Value handler)
Create a default initial list of handlers.


All Packages  Class Hierarchy  This Package  Previous  Next  Index