Article View: comp.lang.modula2
Article #4757Termination
From: Pat Terry
Date: Fri, 07 Apr 1989 04:33
Date: Fri, 07 Apr 1989 04:33
49 lines
2408 bytes
2408 bytes
In article <6380@medusa.cs.purdue.edu>
rjh@cs.purdue.EDU (Bob Hathaway) writes
>Ok, I saw termination code at module scope exit as a generalization of this
>idea, with program termination code being specified as termination code for
>the main program module.
One way of looking at it, certainly "self consistent".
>>I take this to mean you would also like to be able to write, for example
>>
>> PROCEDURE x;
>> (*inner*) MODULE y;
>> . . .
>> BEGIN
>> Initialise;
>> SetTerminate(Cleanup)
>> END y;
>>
>> ...
>> END x;
>>
>>so that whenever x was called "Initialise" was invoked, and whenever x
>>returned "CleanUp" was invoked.
>Yes, this is what I meant. However, for top-level modules serving as
>abstract state machines there is no means for calling CleanUp just before
>the end of x, since no x exists, and an explicit termination code section
>is therefore required.
No, but x has to be "called", and so its "body" can call CleanUp each time
this call is made, just before it "returns"?
>As I remember, Pascal-Plus has something like the following syntax:
Something like, certainly. But in Pascal Plus the "envelopes" are much
more like "classes", and act as "templates" of which one then creates
instances, as many as one likes/needs. The Modula-2 MODULE can't be
replicated in quite the same nice way (which I take to be what you would
really need for abstract state machines) The SetTermination proposal is in
line with lots of M-2 - find a simple way of handling 90% of the cases with
10% of the effort needed for a larger language (and does not require a
syntactic addition to the language as the Pascal-Plus *** statement would
be).
--
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:
<945.243C1EDF@dawggon.fidonet.org>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!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!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!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: Termination Message-ID: <945.243C1EDF@dawggon.fidonet.org> Date: 7 Apr 89 04:33:29 GMT Sender: ufgate@dawggon.fidonet.org (newsout1.26) Organization: FidoNet node 2:490/19.101 - Settler City Fido, Grahamstown RSA Lines: 49