gm2
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gm2] cath exceptions raised in another module's init section


From: Gaius Mulley
Subject: Re: [Gm2] cath exceptions raised in another module's init section
Date: Wed, 06 Jan 2010 16:08:43 +0000
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux)

Fischlin Andreas <address@hidden> writes:

> Dear Martin,
>
> Whoops, please be careful. I do not know the ISO definition, but
> Wirth's philosophy of Modula-2 would require the exception first being
> caught or at least giving notification within the module where it
> occurs. Anything else comes very contrary to the very nature of
> modules and recursive descendent philosophy of Modula-2.

Hi Andreas and Martin,

yes ISO allows exceptions to be caught in the module they are raised.
These have priority over stacked exception handlers.

> There was also an entire thesis written on a related subject
> (Knudsen). The Modula-2 linking loader knows a stack of programs. Each
> level being a program module that is activated on top of the other.
> Any module referenced by several levels is used in a shared manner. If
> an exception occurs, each module is notified and can deal with the
> exception, e.g. do garbage collection. If a level is to be terminated,
> i.e. aborted, all termination handlers are called and only then is the
> top level unloaded. Any library module still in use by a lower level
> is kept in memory and next lower level program is resumed according to
> the stack structure. Of course this runs somewhat contrary to
> exceptions, that are in such an implementation not needed to be
> propagated into the source code at all. IMHO preferable over exception
> handling, but that's beside the point. The only thing needed is a
> simple declaration of initialization and termination procedures for
> every module that are called in case of exceptions by Modula-2's run
> time system.
>
> I would hate if gm2 would get too much in the way of such philosophies
> or we would never be able to port all our vast code to gm2. Every
> module involved in an exception needs to have a chance to get notified
> and to be able to trigger some action, typically releasing memory.
> BTW, which is different from garbage collection, since this is in
> case of Modula-2 not yet garbage!

no problem here.. exceptions handling in gm2 behave in the expected
fashion..

> Consult this module for seeing such a philosophy in practice: DEF's: h
> ttp://se-server.ethz.ch/RAMSES/Objects/DM/DMSystem.html#DMSystem
> explaining such stack management of program modules.

sure the overall functionality looks very similar.  The difference is
that ISO does allow exceptions in the BEGIN END section of a module.

regards,
Gaius




reply via email to

[Prev in Thread] Current Thread [Next in Thread]