Re: Wirth and Exceptions
- From: "Chris Burrows" <cfbsoftware@xxxxxxxxxxx>
- Date: Fri, 18 Jul 2008 10:42:26 +0930
"john o goyo" <j.o.goyo@xxxxxxxxxxxx> wrote in message
news:fJWdncPhTfla1-LVnZ2dnUVZ_i2dnZ2d@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Given Wirth's antipathy to exception mechanisms, I was surprised to read
the following paragraph in his article "The Module [...]" (vide infra).
Did he ever implement such mechanisms in any of his compilers?
There is an exceptions module included in the PDP-11 version of the Modula-2
compiler which originated from ETH:
DEFINITION MODULE Exceptions; (* Ch. Jacobi 9-Dec-79 *)
(* Unix version 19.05.81 *)
FROM SystemTypes IMPORT ErrorType;
EXPORT QUALIFIED Call, Raise, context, ExeptionPointer;
PROCEDURE Call(p: PROC; VAR res: ErrorType);
(* p: Procedure called.
res: Reason for termination of p.
Producing a PostMortemDump is in the responsibility
of the caller: to propagate the error a call
of Raise(res) is possible.
A small area of the stack is reserved, to
allow the post mortem dump routine not to
destroy the user stack.
Calling Call from other than main process can give
a disaster if later on the main process itself
produces an error. It is possible to change the
context on which exceptions are handled.
Priority is maintained. *)
PROCEDURE Raise(error: ErrorType);
(* Raise (cause) an error;
Raise(propagate) propagates the error
which occured before *)
TYPE ExeptionPointer; (* very hidden ! *)
VAR context: ExeptionPointer;
(* could be used for switching exception
context through a scheduler, don't use
it otherwise *)
END Exceptions.
--
Chris Burrows
CFB Software
http://www.cfbsoftware.com/modula2
.
- References:
- Wirth and Exceptions
- From: john o goyo
- Wirth and Exceptions
- Prev by Date: Wirth and Exceptions
- Next by Date: Re: XDS-Modula for OS/2
- Previous by thread: Wirth and Exceptions
- Next by thread: Re: XDS-Modula for OS/2
- Index(es):
Relevant Pages
|