[climacs-devel] proposal for better error handling
Robert Strandh
strandh at labri.fr
Wed Feb 23 08:26:09 UTC 2005
Hello,
I would like your reaction to the following proposal, because it
alters the buffer protocol slightly:
* keep the no-such-offset condition, but make it be signaled only
when an attempt is made to get to an object before the beginning
or after the end of the buffer.
* introduce two new conditions that inherit from no-such-offset:
offset-before-beginning and offset-after-end with the obvious
interpretation.
* introduce a new condition invalid-motion used when an attempt is
made to move a mark to an offset before the beginning or after the
end of the buffer.
* introduce two new conditions that inherit from invalid-motion:
motion-before-beginning and motion-after-end with the obvious
interpretation.
* leave unspecified what happens if an attempt is made to use a mark
with an invalid offset (< 0 or > size), other than neither of the
conditions above will be signaled. This is a fatal error that
should never occur, but we can leave it to the underlying buffer
implementation to detect and signal it, for instance in the form
of an illegal array reference. Leaving this unspecified avoids
having to test for it or establish a handler for some condition in
the underlying implementation, which will improve performance.
With this proposal, the top-level loop can handle these conditions and
give some reasonable message. Climacs commands can choose either not
to bother and let the top-level loop handle them or else to handle
them and do something reasonable in case that turns out to be a better
strategy.
Let me know what you think.
--
Robert Strandh
---------------------------------------------------------------------
Greenspun's Tenth Rule of Programming: any sufficiently complicated C
or Fortran program contains an ad hoc informally-specified bug-ridden
slow implementation of half of Common Lisp.
---------------------------------------------------------------------
More information about the climacs-devel
mailing list