Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!udel!princeton!newross!atomic.Princeton.EDU!nr From: nr@atomic.Princeton.EDU (Norman Ramsey) Newsgroups: comp.lang.modula3 Subject: Proposal for change in the RTMisc interface Message-ID: <1991Apr2.165738.727@newross.Princeton.EDU> Date: 2 Apr 91 16:57:38 GMT Sender: news@newross.Princeton.EDU (USENET News System) Organization: Princeton Computer Science Dept Lines: 37 Originator: nr@atomic.Princeton.EDU The current RTMisc interface handles ``cleanup on exit'' as follows: TYPE Exitor <: REFANY; PROCEDURE RegisterExitor (p: PROCEDURE (n: INTEGER)): Exitor; (* Registers the procedure p to be executed when Exit is called; it is passed the argument of Exit. The registered procedures are executed in the reverse order. *) PROCEDURE UnregisterExitor (e: Exitor); (* removes e's procedure from the registered set. *) PROCEDURE Exit (n: INTEGER); (* call the registered exitors and terminate the program with status 'n' *) I propose the following change, to make it possible for exitors to have more state: TYPE Exitor <: REFANY; TYPE ExitorClosure = OBJECT METHODS apply(n:INTEGER); END; PROCEDURE RegisterExitor (p: ExitorClosure): Exitor; (* Registers the procedure p to be executed when Exit is called; it is passed the argument of Exit. The registered procedures are executed in the reverse order. *) PROCEDURE UnregisterExitor (e: Exitor); (* removes e's procedure from the registered set. *) PROCEDURE Exit (n: INTEGER); (* call the registered exitors and terminate the program with status 'n' *) Comments? -- Norman Ramsey nr@princeton.edu