Extend the exception interface and hierarchy

Exceptions now provide methods for retrieving information from their
backtraces, as well as access to the backtrace itself. The hierarchy of
errors has been split between the pre-existing Internal Error, which
represents a bug in the interpreter; Runtime Error, which indicates an
error in the runtime due to an erroneous program; and Logic Error, which
indicates an error as a result of a program that is semantically correct
but which has nonetheless produced an error. Two, unused classes of
exceptions now exist in the prelude, for future use, as well as a new
Logic Error that indicates use of an abstract method.

To facilitate this change, adds a fold() startingWith() method to
sequence (and therefore strings), and has made the tidy up of the
backtrace following use of assert() more consistent and reliable. A new
pattern called 'Foreign' has also been added, which matches against
JavaScript objects that are not Grace objects.
Rename the Event* types to Procedure*

The name Event was chosen because it often appeared as a response to an
event, but it does not actually represent an event. The family of types
has been renamed to Procedure, as this reflects their status as objects
which take some input and produce no output.
Retrieve dialect methods directly from the object

The existing dialect mechanism required that the object set to 'self' at
the top-most scope, but also that all the method names appeared in the
scope object. Now the searchScope method will look in self when it
reaches the top. This resolves a bug where custom dialects would not
respond to outer, as they did not have their methods copied into scope.
Ensure delegation sets the appropriate self value

The value of self in a Grace-defined method is always bound to the
surrounding scope, even if the actual method is called with a different
context. Now Grace methods will look at the context they were called in
and swap out the calling self if the two are different. This allows the
delegateTo() method to set the self value to the calling object.

Note that, because the value of self no longer necessarily reflects the
surrounding environment, a local search must look in both self and
scope, in the at order.
Resolve confidential errors after object creation

The confidential override error was raised if a method was added that
was not confidential while a confidential method was already attached to
the object. However, this was always the case when a confidential method
was already attached, because the annotations on the new method had not
been run yet. Now confidential validation is performed after annotations
are run.
Override base asString as early as possible

The existing stringification extension in the compiler happened after
the object's constructor had run, meaning that objects would have the
base asString during their construction and the specialised form
afterwards. Now the extension happens alongside the check for
confidential overrides, at the top of an object's inheritance hierarchy
and right before any constructor code runs.

The default overriding checker has been updated to handle existing code
in an object's prototype, meaning the asString method can no longer be
overridden by a variable.
Add general property indexes on foreign objects

All non-Grace objects now implicitly feature the methods at() and
at() put(), which correspond to a direct property getter and setter
respectively. Note that this translates to zero-indexed access on
JavaScript strings and arrays.
Add single argument methods from Math onto Number

The Number implementation has been fleshed out with methods from the
JavaScript Math object that operate on single numbers. Operations that
produce NaN raise Not A Number. The Number type has been extended to
include both the new types and some missing old ones, and a new type
'Order' has been introduced that includes the comparison operators.
Add string utilities to String

The String implementation has had a number of utilities added to it,
including ordering, find and replace and index searching. The index
searching should also be on Sequence, but it is harder to implement due
to the JavaScript indexOf not allowing a custom comparator. The String
type has been updated to include these utilities.
Move setimmediate import to appropriate module

The import of the setimmediate module was in the interpreter rather than
in task, which produced an issue of import order if setImmediate was not
already present in the system. Now the task module will import
setimmediate before setting anything else up, ensuring that it exists
before the task mechanism is used.
Add asPrimitive method to sequences

Sequences will now convert into JavaScript arrays when passed into
foreign functions. They will attempt to convert their contents to
primitives, if the appropriate method exists. This ensures that
sequences of objects that can be converted to primitives work seamlessly
with foreign definitions.
Use foreign lookup when objects in scope

When an object was a Grace object, but had methods which were foreign,
there was no coercion of parameters and result, and no special lookup
for built-in methods occurred. The same applied to objects which were
not Grace objects, but appeared in scope. Now the lookup only considers
whether the requested method is a Grace method, and is applied to
lookups on a self or outer object in scope.
Use self as receiver when requesting local methods

Unqualified requests to local methods always used null as the receiver.
This isn't an issue with regular Grace methods, as their value of self
is always retrieved from the surrounding scope rather than from 'this'.
However, Grace objects may inherit from internal definitions which do
use 'this', so now unqualified requests to these methods will no longer
have a null receiver.
Rename Nothing to None

The specification specifies the type which matches nothing as 'None'.
The existing Nothing type has been renamed to match this.
Add internal toNumber and toString helper methods

There were a lot of cases in the primitive method definitions that cast
a value to a built-in type and then converted it into a primitive. This
common case has been joined together in two helper methods for numbers
and strings.
Add a simple mutable list class and type

The list factory inherits from the sequence factory, so the sequence
factory has been adjusted to call factory methods on self rather than on
an outer reference. The lists themselves inherit from sequences, which
now have confidential methods 'internalPush' and 'internalSplice'. These
methods provide access to the underlying primitive array, without
performing primitive unwrapping when adding to the array.

The sequence methods have been adjusted to just pull the internal array
out of its local object state. Slice methods have also been added.