Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!rutgers!mtune!codas!usfvax2!pdn!alan From: alan@pdn.UUCP (Alan Lovejoy) Newsgroups: comp.lang.modula2 Subject: Re: procedure parameters and TRANSFER Message-ID: <1323@pdn.UUCP> Date: Tue, 15-Sep-87 16:55:28 EDT Article-I.D.: pdn.1323 Posted: Tue Sep 15 16:55:28 1987 Date-Received: Fri, 18-Sep-87 01:43:10 EDT References: <1966@uvacs.CS.VIRGINIA.EDU> Reply-To: alan@pdn.UUCP (0000-Alan Lovejoy) Organization: Paradyne Corporation, Largo, Florida Lines: 32 Keywords: OS, TRANSFER In article <1966@uvacs.CS.VIRGINIA.EDU> rlc@uvacs.CS.VIRGINIA.EDU (Robert L. Chase) writes: >In setting up coroutines in Modula2, the NEWPROCESS procedure >requires that the PROC (coroutine) be a parameterless procedure. >Can anyone assist me with why that is the case? What is the >underlying mechanism that requires this? The underlying mechanism that "requires this" is that a well-designed language avoids complicating the life of a certain language and/or compiler designer named Niklaus Wirth. Specifically, the NEWPROCESS pseudo-procedure has the formal header definition: PROCEDURE NEWPROCESS(p: PROC; workArea: ADDRESS; workAreaSize: CARDINAL; process: ADDRESS); and a parameter of type PROC has to be a parameterless procedure. The language has no facility for specifying a procedure with a generic argument profile, and to make a special case for NEWPROCESS means more work for Niklaus Wirth as well as introducing an irregularity. Personally, I think the NEWPROCESS procedure *should* be a special case which allows procedures of any type, but its not my language. An even better solution would be to change the semantics of NEWPROCESS so that the PROCEDURE (MODULE) that invokes NEWPROCESS is the one that gets instantiated as a process. The formal definition would then be: PROCEDURE NEWPROCESS(workArea: ADDRESS; size: CARDINAL; VAR process: ADDRESS). This makes it unnecessary to specify the source-proc, since it is now known to be the caller. Lacking such changes to the syntax of Modula-2, the simplest and least elegant fix is to "pass" parameters via global variables. Ugh. --alan@pdn