Article View: comp.lang.modula2
Article #4776Re: Termination
From: Pat Terry
Date: Sun, 16 Apr 1989 00:28
Date: Sun, 16 Apr 1989 00:28
49 lines
2408 bytes
2408 bytes
In <6466@medusa.cs.purdue.edu>
rjh@cs.purdue.EDU (Bob Hathaway) writes
> Um, top-level modules are of the form:
>
> MODULE x;
> MODULE y;
> . . .
> BEGIN (* y *)
> (* y. *)Initialise;
> *** (* A termination block begins after *** *)
> (* y. *)Terminate;
> END y;
> . . .
> BEGIN (* x *)
> (* x. *)Initialise;
> ***
> (* x. *)Terminate;
> END x;
>
> x is a top-level module, y is a nested module and since the lifetime of
> a module is the lifetime of its surrounding environment, x's lifetime
> is the lifetime of the program and y's lifetime is the lifetime of x
> and transitively the lifetime of the program. If there is no
> termination code construct in modules, x.Terminate would have to be
> called at program termination by the main program and y.Terminate
> would have to be called by x.Terminate, all of which can be eliminated
> by a termination construct similar to the *** construct in Pascal-Plus
> and as shown above.
But this can also be achieved - for these top level modules - by the
suggestion that WG13 are now making, and which started this whole
discussion. We seem to be talking in circles now or am I still missing
something (sorry to appear dim)?
> I've implemented a class construct with initialization code, and
> termination code would be a trivial addition. I don't see why Modula
> modules are any different, the initialization code is invoked at
> program entry for top-level modules (with elaborate pragmas:-))
How elaborate? Do you/Can you do this all in standard modula-2 without
compiler support, SYSTEM.fiddles and so on?
--
uucp: {mcvax!uunet,tektronix,sun!nosun}!oresoft!dawggon!2!490!19.101!Pat.Terry
Internet: Pat.Terry@p101.f19.n490.z2.fidonet.org
Technical Details
Message-ID:
<1009.2447FD34@dawggon.fidonet.org>Path:
arc1-ca.pugleaf.net!utzoo!dptcdc!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!pasteur!ames!sun-arpa!male!pitstop!sundc!seismo!uunet!tektronix!percival!qiclab!m2xenix!dawggon!p101.f19.n490.z2.fidonet.org!Pat.TerryShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!dptcdc!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!pasteur!ames!sun-arpa!male!pitstop!sundc!seismo!uunet!tektronix!percival!qiclab!m2xenix!dawggon!p101.f19.n490.z2.fidonet.org!Pat.Terry From: Pat.Terry@p101.f19.n490.z2.fidonet.org (Pat Terry) Newsgroups: comp.lang.modula2 Subject: Re: Termination Message-ID: <1009.2447FD34@dawggon.fidonet.org> Date: 16 Apr 89 00:28:08 GMT Sender: ufgate@dawggon.fidonet.org (newsout1.26) Organization: FidoNet node 2:490/19.101 - Settler City Fido, Grahamstown RSA Lines: 49