Re: Wirth and Exceptions



"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



.



Relevant Pages

  • Re: Note function
    ... you're using it in a context where the exceptions won't make a difference, ... is that definition often has a great deal to do with context. ... he gave this as an answer to my saying ... so frustrated with the constant opinion, no fact, opinion, no fact, ...
    (rec.music.theory)
  • Re: Exception vs Boolean
    ... I don't think there's any real loss of context here. ... my opinion is completely in disharmony with the ideas of the main persons ... The interesting thing is the negative attitude towards exceptions ... think that you should not say that but Scott. ...
    (microsoft.public.dotnet.general)
  • Re: Exception vs Boolean
    ... I don't think there's any real loss of context here. ... opinion is completely in disharmony with the ideas of the main persons who ... The interesting thing is the negative attitude towards exceptions ... The first answer from Scott was a very clear text for me. ...
    (microsoft.public.dotnet.general)
  • Re: Fortran DLL call from excel
    ... [quoting something, from context, possibly IVF docs] ... Exceptions exist, though I suppose that the "nearly always" does allow ... different compilers for the same language. ... There are differences in calling conventions among compilers for the ...
    (comp.lang.fortran)
  • Re: Exception vs Boolean
    ... I don't think there's any real loss of context here. ... The interesting thing is the negative attitude towards exceptions ... *in a Function* an enum is more describing and as Scott wrote less consuming ... recommend using an enum as an error code instead of using an exception. ...
    (microsoft.public.dotnet.general)